IllegalArgumentException in Servlet
I am trying to migrate an existing application to weblogic.
One of our Servlet uses the servlet API to get the header "If-Modified-Since".
It works well on Tomcat and OC4J, but weblogic throws:
java.lang.IllegalArgumentException: Bad date header: 'Wed, 15 Oct 2008 18:37:31 GMT'
at weblogic.servlet.internal.ServletRequestImpl.getDateHeader(ServletRequestImpl.java:983)
at javax.servlet.http.HttpServletRequestWrapper.getDateHeader(HttpServletRequestWrapper.java:83)
at com.jivesoftware.base.action.util.ResourceLoaderServlet.isModified(ResourceLoaderServlet.java:661)
at com.jivesoftware.base.action.util.ResourceLoaderServlet.doGet(ResourceLoaderServlet.java:171)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
Truncated. see log file for complete stacktraceThank you
First lesson: Google for "IllegalArgumentException: Bad date header". As soon as you see an error message you haven't seen before, google the parts of the message that are not specific to your application. You'll very often come close to a solution to the problem just with this information alone.
It appears from reviewing those search results that WebLogic is strictly validating the value of the "If-Modified-Since" header. the [RFC 822 spec|http://www.faqs.org/rfcs/rfc822.html] is pretty clear that the year should be 2 digits, and not 4.
Past that, I don't know that value was submitted, whether on the client side or the server side (this point is also raised in some of the search results), so it's impossible to say what erroneously entered that value.
Similar Messages
-
Cannot invoke servlet from JSP
I am trying to invoke a servlet from my JSP file. At present I am getting the error:
500 Internal Server Error
java.lang.IllegalArgumentException: Resource /servlet/CreateSPSS not found
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.EvermindPageContext.forward
I understand that my JSP cannot find my servlet but I cannot identify what the correct path or amendment is.
My JSP file is located in:
default-web-app/examples/jsp/com.xml2spss.jsp
In the JSP my forward parameter is :
<jsp:forward page="/servlet/CreateSPSS" />
and my servlet (.java & .class) is located in
default-web-app/WEB-INF/classes/com/pmstation/spss/site/servlet.CreateSPSS.java
I have added the following line to Web.XML:
<servlet-mapping>
<servlet-name>CreateSPSS</servlet-name>
<url-pattern>/servlet/CreateSPSS</url-pattern>
</servlet-mapping>
Where am I going wrong??
Thankyou for any help at all on this one.Shaun,
Nice to know that you find a way that works. However, what Zsolt suggests should work; otherwise, it is a bug. That is, put the servlet definition and servlet mapping in your web.xml and then you should be able to access http://host:port/myWebContext/servlet/CreateSPSS?myParmName=myParm without seeing a response like "No resource found". Please make sure that your servlet definition come before the corresponding servlet mapping. -
i have a problem trying test my jdeveloper essential on a glassfish server i have the next exception when i try to deploy the EAR
Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: oracle/adf/share/logging/ADFLogger.
what can i do?
thnaksHi,
did you install the ADF library files on glassfish as documented here?
http://docs.oracle.com/cd/E35521_01/admin.111230/e16179/ap_glassfish.htm#BABIEADD
You download the runtime libraries to be installed on Glassfish from here
http://www.oracle.com/technetwork/developer-tools/adf/downloads/index.html
See --> Oracle ADF Essentials Download option
Frank -
Servlet error java.lang.IllegalArgumentException: path must begin with a "/
I have just deployed my web app to the oc4j 10 g latest release and whenever I try to log into the webapp I get the following error.
Servlet error
java.lang.IllegalArgumentException: path must begin with a "/"
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:1658)
at org.apache.struts.action.RequestProcessor.doInclude(RequestProcessor.java:1092)
at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:252)
at org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:341)
at org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:582)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:260)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:50)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)
at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:254)
at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:309)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
at com.janes.jf.filter.LoginFilter.doFilter(LoginFilter.java:25)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
Can someone please help me?
Thanks in advance.add this after your action-mappings section of struts-config.xml
<!-- ========== Controller Configuration ================================ -->
<controller>
<!-- The "input" parameter on "action" elements is the name of a
local or global "forward" rather than a subapp-relative path -->
<set-property property="inputForward" value="true"/>
<set-property property="processorClass" value="org.apache.struts.tiles.TilesRequestProcessor"/>
</controller> -
IllegalArgumentException while accessing an EJB with a servlet client
Dear All,
Hey,
I am facing some problems while accessing a deployed stateless ejb. Following is how my application is being accessed:
WEBAPP CLIENT
caller.html ------->> DisplayServletClient --------->> DisplayServlet
(Simple HTML Page) (Servlet which performs lookup) (The actual bean)
CONSOLE CLIENT
DisplayConsoleClient --------->> DisplayServlet
(Simple Console Client) (The actual bean)
I am using the J2EE reference implementation, the ejb bean is successfully deployed. The console client successfully, access the ejb. But when I try to access the ejb using the webapp client, I get the following exception:
======= EXCEPTION ENCOUNTERED ============
Application DisplayApp deployed.
Servlet Entered
HTML Content Type Set
PrintWriter Object Created
Context Object Created
Exception in Servlet Client Code: java.lang.IllegalArgumentException: Unknown co
mponent type
java.lang.IllegalArgumentException: Unknown component type
at com.sun.enterprise.naming.NamingManagerImpl.getComponentType(NamingMa
nagerImpl.java:670)
at com.sun.enterprise.naming.NamingManagerImpl.getMangledIdName(NamingMa
nagerImpl.java:708)
at com.sun.enterprise.naming.NamingManagerImpl.getComponentIdInternal(Na
mingManagerImpl.java:680)
at com.sun.enterprise.naming.NamingManagerImpl.getComponentId(NamingMana
gerImpl.java:313)
at com.sun.enterprise.naming.java.javaURLContext.getComponentContext(jav
aURLContext.java:397)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.j
ava:51)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at DisplayServletClient.service(DisplayServletClient.java:27)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServl
et.java:428)
at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java
:180)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationF
ilterChain.java:197)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilt
erChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:215)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve
.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2314)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.ja
va:368)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
r.java:995)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
va:1088)
at java.lang.Thread.run(Thread.java:484)
======== EXCEPTION END ===========
Tweaking with the servlet client code, I have discovered that it is failing to perform a correct lookup. Can anybody suggest any remedy? My Source code is below:
=========================================================
============ Remote Interface START ==============
// The DisplayApp Remote Interface File
import javax.ejb.*;
import java.rmi.*;
public interface Display extends EJBObject
public String display() throws RemoteException;
============ Remote Interface END ==============
============ Home Interface START ==============
// The DisplayApp Home Interface File
import javax.ejb.*;
import java.rmi.*;
public interface DisplayHome extends EJBHome
public Display create() throws RemoteException, CreateException;
============ Home Interface END ==============
============ Bean Class START ==============
// The DisplayApp Bean Class File
import javax.ejb.*;
import java.rmi.*;
public class DisplayBean implements SessionBean
public String display() throws RemoteException
System.out.println("The Server Side Response");
return "Hello, Me a New Friend";
public void ejbCreate(){}
public void ejbRemove(){}
public void ejbActivate(){}
public void ejbPassivate(){}
public void setSessionContext(SessionContext ctx){}
============ Bean Class END ==============
========== Console Client Class START ======
// The Display Console Client Class File
import javax.ejb.*;
import javax.rmi.*;
import javax.naming.*;
import Display;
import DisplayHome;
public class DisplayConsoleClient
public DisplayConsoleClient()
try
Context initial=new InitialContext();
Object objref=initial.lookup("java:comp/env/DisplayJNDI");
DisplayHome home=(DisplayHome)PortableRemoteObject.narrow(objref, DisplayHome.class);
Display ref=home.create();
System.out.println("Client Side: "+ref.display());
ref.remove();
catch(Exception ex)
System.out.println("Exception in Client Code: "+ex);
ex.printStackTrace();
public static void main(String args[])
new DisplayConsoleClient();
========== Console Client Class END ======
========== Servlet Client Class START ======
// The DisplayApp Servlet Client Class File
import javax.ejb.*;
import javax.rmi.*;
import javax.naming.*;
import Display;
import DisplayHome;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class DisplayServletClient extends HttpServlet
private PrintWriter out;
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
try
System.out.println("Servlet Entered");
response.setContentType("text/html");
System.out.println("HTML Content Type Set");
out=response.getWriter();
System.out.println("PrintWriter Object Created");
Context initial=new InitialContext();
System.out.println("Context Object Created");
Object objref=initial.lookup("java:comp/env/ejb/DisplayWEBJNDI");
System.out.println("Lookup Done Successfully");
DisplayHome home=(DisplayHome)PortableRemoteObject.narrow(objref, DisplayHome.class);
System.out.println("Home Object Created");
Display ref=home.create();
System.out.println("Remote Object Created");
out.println("<html><title>The Results Page</title>");
out.println("<body<hr>");
out.println("<h1>The Client Side Response is: ");
out.println(ref.display());
out.println("</h1>");
out.println("<hr>");
out.println("</body></html>");
System.out.println("Responses Done");
out.flush();
System.out.println("Output Stream Flushed");
ref.remove();
System.out.println("Remote Object Removed");
catch(Exception ex)
System.out.println("Exception in Servlet Client Code: "+ex);
ex.printStackTrace();
========== Servlet Client Class END ======
========== Calling HTML File START ======
<html>
<body>
<hr>
<form method="get" action="/servlet/DisplayServletClient">
<input type="submit" name="submit" value="Call Now!">
</form>
<hr>
</body>
</html>
========== Calling HTML File END ======
=========================================================
Since, the descriptors were automatically generated, I have not included them here. Also, I did not build the war, jar, ear files myself, they were automatically generated by the deploytool.
Please help!!
Thanks & Bye,
Tualha KhanHey,
This was the latest code snippet which I used in the Servlet file.
========================
try
System.out.println("Servlet Entered");
response.setContentType("text/html");
System.out.println("HTML Content Type Set");
out=response.getWriter();
System.out.println("PrintWriter Object Created");
InitialContext initial=new InitialContext();
System.out.println("Context Object Created");
Object objref=initial.lookup("DisplayWEBJNDI");
System.out.println("Lookup Done Successfully");
DisplayHome home=(DisplayHome)PortableRemoteObject.narrow(objref, DisplayHome.class);
System.out.println("Home Object Created");
Display ref=home.create();
System.out.println("Remote Object Created");
out.println("<html><title>The Results Page</title>");
out.println("<body<hr>");
out.println("<h1>The Client Side Response is: ");
out.println(ref.display());
out.println("</h1>");
out.println("<hr>");
out.println("</body></html>");
System.out.println("Responses Done");
out.flush();
System.out.println("Output Stream Flushed");
ref.remove();
System.out.println("Remote Object Removed");
========================
The Response was
========================
Servlet Entered
HTML Content Type Set
PrintWriter Object Created
Context Object Created
Exception in Servlet Client Code: javax.naming.NameNotFoundException: DisplayWEB
JNDI not found
javax.naming.NameNotFoundException: DisplayWEBJNDI not found
<<no stack trace available>>
========================
So what else should I do???
Thanks & Waiting,
Tualha Khan -
How do i call the method in a class using servlet
i am doing a project which need to use servlet to call a few methods in a class and display those method on the broswer. i tried to write the servlet myself but there are still some errors .. can anyone help:
The servlet i wrote :
package qm.minipas;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class test extends HttpServlet {
Database database;
/** Initializes the servlet.
public void init(ServletConfig config) throws ServletException {
super.init(config);
database = FlatfileDatabase.getInstance();
/** Destroys the servlet.
public void destroy() {
/** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
response.setContentType("text/html");
java.io.PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet</title>");
out.println("</head>");
out.println("<body>");
out.println("this is my class wossname"+FlatfileDatabase.getInstance()); // this is calling the toString() method in the instance of myJavaClass
out.println("this is my method"+FlatfileDatabase.getAll());
out.println("</body>");
out.println("</html>");
out.close();
/** Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
processRequest(request, response);
/** Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
processRequest(request, response);
/** Returns a short description of the servlet.
public String getServletInfo() {
return "Short description";
my methods which i need to call are shown below:
public Collection getAll() {
return Collections.unmodifiableCollection(patientRecords);
public Collection getInpatients() {
Collection selection=new ArrayList();
synchronized(patientRecords) {
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
if(next.isInpatient())
selection.add(next);
return Collections.unmodifiableCollection(selection);
public Collection getByAdmissionDate(Date dateOfAdmission) {
List selection=new ArrayList();
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
if(dateOfAdmission.equals(next.getDateOfAdmission()))
selection.add(next);
return Collections.unmodifiableCollection(selection);
public Collection getByAdmissionDates(Date from,Date to)
throws IllegalArgumentException {
if(to.before(from))
throw new IllegalArgumentException("End date must not be before start date");
List selection=new ArrayList();
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
Date nextAD=next.getDateOfAdmission();
if((nextAD.after(from)||nextAD.equals(from))
&&(nextAD.before(to)||nextAD.equals(to)))
selection.add(next);
return Collections.unmodifiableCollection(selection);
public Collection getByDischargeDates(Date from,Date to)
throws IllegalArgumentException {
if(to.before(from))
throw new IllegalArgumentException("End date must not be before start date");
List selection=new ArrayList();
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
Date nextAD=next.getDateOfDischarge();
if(nextAD==null)
continue;
if((nextAD.after(from)||nextAD.equals(from))
&&(nextAD.before(to)||nextAD.equals(to)))
selection.add(next);
return Collections.unmodifiableCollection(selection);
public Collection getByConsultant(String consultant) {
List selection=new ArrayList();
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
if(consultant.equalsIgnoreCase(next.getConsultant()))
selection.add(next);
return Collections.unmodifiableCollection(selection);
public Collection getByDischargeDate(Date dateOfDischarge) {
List selection=new ArrayList();
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
if(dateOfDischarge.equals(next.getDateOfDischarge()))
selection.add(next);
return Collections.unmodifiableCollection(selection);
public Collection getBySurname(String surname) {
List selection=new ArrayList();
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
if(surname.equalsIgnoreCase(next.getSurname()))
selection.add(next);
return Collections.unmodifiableCollection(selection);
public Collection getByWard(String ward) {
List selection=new ArrayList();
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
if(ward.equalsIgnoreCase(next.getWard()))
selection.add(next);
return Collections.unmodifiableCollection(selection);please provide a detail description of your errors.
-
How can I call an ".asp" from a Servlet?
I want to make a call to an asp page from my servlet. If i use the conventional way of doing it as follows:
RequestDispatcher rd = getServletContext().getRequestDispatcher("http://localhost:8080/abc.asp");
rd.forward(request, response)
It gives me IllegalArgumentException saying that the "Path must be absolute". And if i give the relative path like
RequestDispatcher rd = getServletContext().getRequestDispatcher("/abc.asp");
rd.forward(request, response)
In this case it takes me to the asp page, but gives some ClassNotFoundException - images.
I do not understand what class it is looking for and where to get that?
So Why am i not able to call an ASP from Servlet, Any clue??What are you trying to accomplish? A redirect is one of the only ways to successfully go from a Servlet to an ASP. For example:response.sendRedirect("http://server:9090/abc.asp?name=value");This is mainly because when you forward, your actually sending the request and response objects under the current servlet context to be processed by another JSP/servlet in the same (sometimes cross) context.
When interacting with ASP's your actually communicating between web containers (one which is Java based the other VB based).
When you use:RequestDispatcher rd = getServletContext().getRequestDispatcher("http://localhost:8080/abc.asp");
rd.forward(request, response) Your telling the servlet to send it's contents outside the web container where they cannot exist as such (even though you are pointing to your own JSP server, it's the "http://" that makes it assume your trying to get out).
Using: RequestDispatcher rd = getServletContext().getRequestDispatcher("/abc.asp");
rd.forward(request, response) is fine but what is processing your asp in your Java Web Server?
The best way to mix JSP/Servlets with ASP (in my opinion others may debate it if they please) is using messaging like XML. Trying to share sessions between ASP and Java is quite messy and to much effort for a 1 to 1 communication option.
Back to an earlier question, what is processing your asp files in the Java web server? If you have something processing them (like ChilliSoft) then check the docs to see if it supports session sharing between JSP/Servlet - ASP.
Anthony -
Invoking web service from EJB3 throw java.lang.IllegalArgumentException
I used JAX-WS to develop a web service and deployed it on webloigc 10.3.5. The web service was invoked from web application and it worked fine. However, when I tried to invoke the web service from a stateless session bean, java.lang.IllegalArgumentException was thrown out and complained that "*interface gov.fema.web.nimcast.service.client.UpdateEmailPortType is not visible from class loader*". I tried following three ways to solve the problem
1. put the web service client artifacts under APP-INF/classes of the EAR
2. bundle the web service client artifacts into a jar file and put it under APP-INF/lib of the EAR
3. put the web service client artifacts into the same jar file of the EJB
However, none of the above approaches worked out, every time same exception thrown out.
I used following commands in my ant script to generate the web service client artifacts
<path id="deploypathref">
<fileset dir="${wl.server}">
<include name="server/lib/weblogic.jar"/>
<include name="server/lib/weblogic_sp.jar"/>
<include name="server/lib/xqrl.jar"/>
<include name="server/lib/webservices.jar"/>
<include name="../modules/features/weblogic.server.modules_10.3.3.0.jar"/>
</fileset>
</path>
<taskdef name="clientgen"
classname="weblogic.wsee.tools.anttasks.ClientGenTask" >
<classpath refid="deploypathref"/>
</taskdef>
<clientgen
wsdl="http://${wls.hostname}:${wls.port}/nimscast/UpdateEmailService?WSDL"
destDir="${path.service}/src"
packageName="gov.fema.web.nimcast.service.client"
type="JAXWS"/>
<javac
srcdir="${path.service}/src" destdir="${path.assembly}/ear/APP-INF/classes"
includes="**/*.java"/>
and following is the detail information from the stack trace:
Caused By: java.lang.IllegalArgumentException: interface gov.fema.web.nimcast.service.client.UpdateEmailPortType is not visible from class loader
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
at weblogic.wsee.jaxws.spi.ClientInstance.createProxyInstance(ClientInstance.java:143)
at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.getPort(WLSProvider.java:855)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:344)
at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.getPort(WLSProvider.java:792)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:326)
at javax.xml.ws.Service.getPort(Service.java:92)
at gov.fema.web.nimcast.service.client.UpdateEmailService.getUpdateEmailPortTypePort(Unknown Source)
at gov.fema.prepcast.beans.UserManagement.updateUserEmailInNimscast(UserManagement.java:622)
at gov.fema.prepcast.beans.UserManagement.changeUserProfileInfo(UserManagement.java:324)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy144.changeUserProfileInfo(Unknown Source)
at gov.fema.prepcast.beans.UserManagement_dinn8k_UserManagementLocalImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionLocalMethodInvoker.invoke(SessionLocalMethodInvoker.java:39)
at gov.fema.prepcast.beans.UserManagement_dinn8k_UserManagementLocalImpl.changeUserProfileInfo(Unknown Source)
at gov.fema.prepcast.actions.secret.UpdateUserAction.saveProfileInfo(UpdateUserAction.java:287)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Edited by: 938276 on Jul 25, 2012 7:55 AMNo you haven't, because
Caused by: java.lang.NoClassDefFoundError: org.example.www.Sample_PortType a relevant class can still not be found and Java really is not going to lie to you; this class is not on your application's classpath so it is either missing or put in the wrong place. Note that missing classes can be caused by you forgetting to properly redeploying your application - its usually something silly like that. Figure out what you did wrong and correct your mistake.
The fact that you have to mention that you "setup the classpath" is questionable; in web applications you don't touch the classpath at all. So what exactly did you do? -
IllegalArgumentException: While exporting to PDF in Websphere 6
Hi,
<br>
We are using Crystal Report XI and Java 1.5. We are using JRC jars to parse the Crystal Report in Server side. From our application we will export the report to PDF. It is working fine for all reports except for a specific report where it gives IllegalArgumentException while exporting the PDF. The same report is working fine in Windows Environment. Only in Linux environment the below error occurred. It will be of great help if any one can suggest us on this.
<br>
Exception:<br>
<br>
[1/31/11 13:31:13:397 CST] 00000026 SystemOut O Openning rowset<br>
[1/31/11 13:31:13:399 CST] 00000026 SystemOut O Executing query: null<br>
[1/31/11 13:31:13:401 CST] 00000026 SystemOut O PdfExporter: serializing pdf document and cleaning up<br>
[1/31/11 13:31:13:401 CST] 00000026 SystemOut O Disk Exporter: verifying export to destination<br>
[1/31/11 13:31:13:401 CST] 00000026 SystemOut O Disk Exporter: no output file was created by an exporter<br>
[1/31/11 13:31:13:407 CST] 00000026 SystemOut O PdfExporter: caught Exception in PDFFormatter.finalizeFormatJob (from destination?); aborting export<br>
java.lang.IllegalArgumentException<br>
at com.crystaldecisions.reports.exporters.destination.disk.c.a(Unknown Source)<br>
at com.crystaldecisions.reports.exporters.format.page.pdf.b.a(Unknown Source)<br>
at com.crystaldecisions.reports.a.e.if(Unknown Source)
at com.crystaldecisions.reports.formatter.a.c.if(Unknown Source)
at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
at com.businessobjects.reports.sdk.b.i.int(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.export(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.AdvancedReportSource.export(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.NonDCPAdvancedReportSource.export(Unknown Source)
at com.mysystem.myapp.common.Crystal_Report.print(Crystal_Report.java:447)
at com.ibm._jsp._Crystal_Report._jspService(_Crystal_Report.java:305)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:87)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1146)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1087)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
at com.mysystem.myapp.common.ServletFilter.doFilter(ServletFilter.java:107)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:837)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:680)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:588)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:481)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:232)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:748)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:122)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497)<br>
[1/31/11 13:31:13:408 CST] 00000026 SystemOut O Disk Exporter: finalizing export to destination<br>
[1/31/11 13:31:13:408 CST] 00000026 SystemOut O JRCAgent203 detected an exception: java.lang.NullPointerException<br>
[1/31/11 13:31:13:413 CST] 00000026 SystemOut O 2011-01-31 13:31:13.411 30706059IBN_IBON MARMAGOST Crystal_Report.print(748) Error while generating crystal report<br>
com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: java.lang.NullPointerException---- Error code:-2147467259 Error code name:failed
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.export(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.AdvancedReportSource.export(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.NonDCPAdvancedReportSource.export(Unknown Source)
at com.mysystem.myapp.common.Crystal_Report.print(Crystal_Report.java:447)
at com.ibm._jsp._Crystal_Report._jspService(_Crystal_Report.java:305)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:87)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1146)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1087)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
at com.mysystem.myapp.common.ServletFilter.doFilter(ServletFilter.java:107)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:837)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:680)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:588)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:481)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:232)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:748)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:122)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497)I recommend searching on that Exception message first.
Sincerely,
Ted Ueda -
Uploading a file using jsp and com.oreilly.servlet lib package
Sorry to bother you but I need your help folks
I am developing an application to pick up files from a database and sent to a specified location on a different system.
I am presently trying to run this code,I have placed this lib package from oreilly which is supposed to encapsulate the usage of file uploads,which is a jar file called cos.jar into C:\Program Files\Java\jdk1.5.0_03\jre\lib\ext folder .I have a jsp page that calls the bean which does the upload and implement the classes in the oreilly package.I am using tomcat 5
[b]the jsp page that acts as the user interface
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Please Choose The File</title>
</head>
<body bgcolor="#ffffff">
<table border="0"><tr>
<form action="Upload.jsp" method="post"
enctype="multipart/form-data">
<td valign="top"><strong>Please choose your document:</strong><br></td>
<td> <input type="file" name="file1">
<br><br>
</td></tr>
<tr><td><input type="submit" value="Upload File"></td></tr>
</form>
</table>
</body>
</html>
this is the jsp page that calls the bean
<jsp:useBean id="uploader" class="com.UploadBean" />
<jsp:setProperty name="uploader" property="dir" value="<%=application.getInitParameter(\"save-dir\")%>" />
<jsp:setProperty name="uploader" property= "req" value="${pageContext.request}" />
<html>
<head><title>file uploads</title></head>
<body>
<h2>Here is information about the uploaded files</h2>
<jsp:getProperty name="uploader" property="uploadedFiles" />
</body>
</html>
[b]this is the bean class
package com;
import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletRequest;
import com.oreilly.servlet.MultipartRequest;
import com.oreilly.servlet.multipart.DefaultFileRenamePolicy;
import javax.servlet.*;
public class UploadBean {
private String webTempPath;
private HttpServletRequest req;
private String dir;
// private ServletRequest request;
public UploadBean( ) {}
public void setDir(String dirName) {
if (dirName == null || dirName.equals(""))
throw new IllegalArgumentException("invalid value passed to " + getClass( ).getName( )+".setDir");
//webTempPath = dirName;
dir = dirName;
/* public String getDir()
return webTempPath;
public void setReq(ServletRequest request) {
if (request != null && request instanceof HttpServletRequest)
req = (HttpServletRequest) request;
} else {
throw new IllegalArgumentException("Invalid value passed to " + getClass( ).getName( )+".setReq");
public String getUploadedFiles( ) throws java.io.IOException{
//file limit size of 5 MB
MultipartRequest mpr = new MultipartRequest(req,dir,5 * 1024 * 1024,new DefaultFileRenamePolicy( ));
Enumeration enume = mpr.getFileNames( );
StringBuffer buff = new StringBuffer("");
for (int i = 1; enume.hasMoreElements( );i++){
buff.append("The name of uploaded file ").append(i).append(" is: ").append(mpr.getFilesystemName((String)enume.nextElement( ))).append("<br><br>");
}//for
//return the String
return buff.toString( );
} // getUploadedFiles
On running the code I find this error messages
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax/servlet/ServletRequest
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.jsp.Upload_jsp._jspService(org.apache.jsp.jsp.Upload_jsp:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NoClassDefFoundError: javax/servlet/ServletRequest
com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:222)
com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:151)
com.UploadBean.getUploadedFiles(UploadBean.java:49)
org.apache.jsp.jsp.Upload_jsp._jspService(org.apache.jsp.jsp.Upload_jsp:63)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
Apache Tomcat/5.5.9
tanksHi,
Looks like you are missing a file from the classpath. Make sure servlet.jar is available in your classpath. Ordinarily files in <tomcat_home>/lib directory should be added automatically. You need to check why it hasn't been added in your case. A good place to start would be the bat files in the bin directory viz startup.bat, catalina.bat etc.
cheers,
vidyut -
Writing Image files from Applet to Servlet
How to write ImageFiles from an Applet to a Servlet?
I draw a image on a JComponent in Applet and wanted to save the image file in the server.
I am unable to write an Image Object to the Servlet as the BufferedImage class is not serialized.
I tried writing the image to the Servlet output stream and tried reading the data in the servlet and writing the data to a jpg file.
But the files is not being written as proper jpeg file.
Any help would be great.
Thanks,
Sridhar.I get the following exception below when i try to write a Serialized object from an applet to the servlet.
I copied the serialized class jar file to the tomcat webserver lib folder.
The serialized class has a BufferedImage object.
Serialized Class Code
public class SerializedImage implements Serializable{
private BufferedImage im = null;
public SerializedImage() {
super();
public BufferedImage getSerializedObject() {
return im;
public void setSerializedObject((BufferedImage im) {
this.im = im;
private BufferedImage fromByteArray(byte[] imagebytes) {
try {
if (imagebytes != null && (imagebytes.length > 0)) {
BufferedImage im = ImageIO.read(new ByteArrayInputStream(imagebytes));
return im;
return null;
} catch (IOException e) {
throw new IllegalArgumentException(e.toString());
private byte[] toByteArray(BufferedImage o) {
if(o != null) {
BufferedImage image = (BufferedImage)o;
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
try {
ImageIO.write(image, "jpg", baos);
} catch (IOException e) {
throw new IllegalStateException(e.toString());
byte[] b = baos.toByteArray();
return b;
return new byte[0];
private void writeObject(java.io.ObjectOutputStream out)
throws IOException {
byte[] b = toByteArray(im);
out.writeInt(b.length);
out.write(b);
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException {
int length = in.readInt();
byte[] b = new byte[length];
in.read(b);
im = fromByteArray(b);
Exception :
java.io.StreamCorruptedException: unexpected block data
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1288)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:18
45)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
646)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
Is there any thing that i am missing or doing wrong?
Thanks,
Sridhar. -
Re: issue with servlet-mapping
Hello,
i got following url pattern on web xml and it works fine on resin, however,
its gives me, java.lang.IllegalArgumentException: Invalid pattern,
is there is a anyway to fix it without altering the file structure.
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/jsf/*.jsf</url-pattern>
</servlet-mapping>Wildcards(*) can be used either at the beginning or end of the pattern.You cannot specify wildcards in the middle of the pattern.
So, only either of these will work
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>Or
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/jsf/*</url-pattern>
</servlet-mapping> -
Flex 4.5 - java.lang.IllegalArgumentException: argument type mismatch
0 down vote favorite
I am having a problem when sending a soap request from a flex 4.5 application to a coldfusion 9 web service created using a CFC.
The most annoying thing it is only an intermittent problem but I can't work out what is wrong.
There a many methods within the web service of which Flex has no issue, but these are mainly ones that read data. The one I am having a problem with is one that is writing back to the web service.
The issue only arises when I have to restart the Coldfusion service for some reason, which is quite often as the development machine is my laptop. It has now also happened when I have moved the Flex app to a development server for testing and as it's hosted I can't restart the services easily.
I get the response below every time. I have tried tracing the call through the Flash Builder Network monitor and building a dummy call using the same data, all to no avail.
I have tried stripping out all of the code and then rebuilding it, which takes a long time as I am using custom types in ColdFusion.
Also , if I cfinvoke the method through a CFM page, it works fine. It is only when trying to call it through a SOAP request through Flex 4.5.
It will then suddenly start working again however and then it is fine until I restart the CF services again.
I can't tell what I triggers it to start working again.
Does something initialise it in ColdFusion and then it's fine ???. I am really struggling with this and any help would be appreciated.
I have a sample SOAP request that I trapped in the Network Monitor and also the WSDL if needed.
java.lang.IllegalArgumentException: argument type mismatch
<ns1:stackTrace xmlns:ns1="http://xml.apache.org/axis/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis.utils.BeanPropertyDescriptor.set(BeanPropertyDescriptor.java:142)
at org.apache.axis.encoding.ser.BeanPropertyTarget.set(BeanPropertyTarget.java:75)
at org.apache.axis.encoding.DeserializerImpl.valueComplete(DeserializerImpl.java:249)
at org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:509)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:171)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:148)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at coldfusion.xml.rpc.CFCProvider.invoke(CFCProvider.java:54)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at coldfusion.xml.rpc.CFCServlet.doAxisPost(CFCServlet.java:270)
at coldfusion.filter.AxisFilter.invoke(AxisFilter.java:43)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:356)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:87)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.xml.rpc.CFCServlet.invoke(CFCServlet.java:138)
at coldfusion.xml.rpc.CFCServlet.doPost(CFCServlet.java:289)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)</ns1:stackTrace>
<ns2:hostname xmlns:ns2="http://xml.apache.org/axis/" xmlns:soapenv
="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org2001/XMLSchema-instance">Darren-LT</ns2:hostname>Someone suggested it could be a serialisation issue but I I'm not sure how to go about checking that.
Any suggestions ? -
J2me & servlet - exception in midlet output
I am invoking servlet in my MIDlet application. when i invoke on my local netword with local ip of web server it works properly on browser and midlet. but when i invoke with internet with global ip of web server it works properly only on browser not on MIDlet. it gives msg - "Uncaught exception java/lang/IllegalArgumentException"
i am not understanding the problem and helpless...
please help me to solve this problem....
my code is here... (for invoking servlet on midlet - i am displaying returning value of this method on form)
methos in medlet
public String invokeServlet(String data) throws IOException
//String url="http://127.0.0.1:8081/dictionary/searchword_mobile?word=" + data; //working properly
//String url="http://192.168.1.54:8081/dictionary/searchword_mobile?word=" + data; //working properly
//String url="http://192.168.0.115:8080/dictionary/searchword_mobile?word=" + data; //working properly
String url="http://202.144.52.226:8080/dictionary/searchword_mobile?word=" + data; //not working gives exception
HttpConnection c = null;
InputStream is = null;
StringBuffer b = new StringBuffer();
try
c = (HttpConnection)Connector.open(url);
c.setRequestMethod(HttpConnection.GET);
c.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0");
c.setRequestProperty("Content-Language", "en-CA");
is = c.openDataInputStream();
int ch;
while ((ch = is.read()) != -1)
b.append((char) ch);
catch (Exception e)
wordbox.setString("Exception " + e);
finally
if(is!= null)
is.close();
if(c != null)
c.close();
return b.toString();
=======================
servlet code
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.dictionary.wordpack.WordDAO;
public class SearchWordServlet_Mobile extends HttpServlet
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException
String word=request.getParameter("word");
String returndata=new WordDAO().searchword_mobile(word);
//System.out.println("word for searching : " + word);
response.setHeader("Content-Type", "application/octet-stream");
response.setHeader("Cache-Control","no-store");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Pragma","no-cache");
response.setHeader("Cache-Control", "no-transform");
response.setHeader("Connection", "Keep-Alive");
response.setHeader("Proxy-Connection", "Keep-Alive");
response.setContentType("text/plain");
response.setContentLength(returndata.length());
ServletOutputStream out=response.getOutputStream();
out.print(returndata);
out.close();
=====================
plseae suggest me solution for this problem.
thanks in advance...Are you able to receive any data in simulator I mean to say are you getting the same exception in simulator too?
Use POST method in place of GET, and check.
What are you passing in the variable data? May be the data size is exceeding the limit.
If you resolved then don't forget to reward!!!
Shan!!! -
How to access XM attribute name in servlet ?
Hi All,
Anybody please tell me how to access attribute name in servlet ?
ThanksHi All,
I have modified the source code of af:showDetailItem as following:
<af:forEach items="#{bindings.VerticalAppMenus.children}" var="globalMenu" varStatus="globalMenuVarStatus">
<af:showDetailItem text="#{globalMenu.MenuLabel}" id="sdi1" disclosureListener="#{pageFlowScope.globalMenus.refreshLineMenus}"
disclosed="#{(pageFlowScope.globalMenus.currentVerticalMenuId == globalMenu.MenuId) ? true : false}">
<f:attribute name="currentVerticalMenuId" value="#{globalMenu.MenuId}"/>
</af:showDetailItem>
</af:forEach>For the code *disclosed="#{(pageFlowScope.globalMenus.currentVerticalMenuId == globalMenu.MenuId) ? true : false}"*, at runtime it is giving the following error:
*java.lang.IllegalArgumentException: Cannot convert 32 of type class oracle.jbo.domain.Number to class java.lang.Long*.
Is there any way to cast the long to number or number to long in EL?
Any help will be highly appreciated
Thanks ... Best Regards
Bilal
Edited by: Bilal on 04-Apr-2012 19:32
Maybe you are looking for
-
8i and 9i on same server?
Forgive me if this has been asked before, or if this is a really stupid question. Is it possible to run both an 8i database and a 9i database on the same server? I'm thinking about trying separate Oracle homes to accomplish this, but I wanted to know
-
I am connected to the internet, when i do diagnostics in itunes it shows this on the first 2 categories and then on the third category says i am not connected. Error message 306 keeps coming up. I am using firefox in windows 8, how can i resolve th
-
My source does not compile in 1.5 because of generics in libraries
Hi, I have a problem with my source codes written for 1.3 and 1.4 java. I have been implementing Iterator, Collection, List and extending ArrayList in many ocassions. All works as expected in 1.4 but if I try to compile it with 1.5 it does not compil
-
Same functions with different return types in C++
Normally the following two functions would be considered the same: int getdata ( char *s, int i ) long getdata ( char *s, int i ) Every other compiler we use would resolve both of these to the same function. In fact, it is not valid C++ code otherwis
-
Hi all, In copy controls we maintained pricing type B- carryout new pricing. Eventhough in pricing analysis its showing the current prices, Butthe sales order prices are being copied from reference sales order i.e. Item conditions screen. Any body c