java.lang.NoClassDefFoundError: javax.servlet.ServletInputStream Error deploying on websphere - java

I have created a jersey web service with neatbeans using glassfish as my server, everything works fine but i have issues trying to install the same app on websphere 7.
i get this error "Error 500 An error occurred while processing request: /ibm/console/upload.do Message: java.lang.NoClassDefFoundError: javax.servlet.ServletInputStream".
I even tried creating a simple web app and tried to deploy on websphere, again, i have the same error.
Anybody with ideas? I need your help so badly ya'll. Thanks in advance

Make sure you don't have servlet-api.jar in your WEB-INF/lib. If its there it may interfere with the one already present in websphere a trick the classloader

I did below steps which worked for me :
Go to the server in console(which was stand - alone in my case i.e no DMGR)
Change the class loader policy to "multiple".

I suppose I am not too late to reply to this question. The HttpServlet class can be found in the j2ee.jar. WAS does not bundle it in servlet-api.jar, the way Tomcat does it.

You need to bundle servlet-api.jar file in your application.

Related

Error parsing application.xml when trying to publish a WebLogic 12.2.1 application

I have Java web application that runs on WebLogic 12.2.1. I've never had any trouble publishing to run locally - until now.
Now I always get the following error:
weblogic.management.DeploymentException: Error parsing META-INF/application.xml
The application.xml file itself seems fine, and it definitely hasn't changed. I can't figure out what the issue is.
Any suggestions? Thanks.
Thanks for the steer. It all has to do with replacing every instance of
http://java.sun.com/xml/ns/javaee/
with
http://xmlns.jcp.org/xml/ns/javaee/
in your xml files such as application.xml and weblogic.xml.

Error 404: SRVE0190E: File not found: {0} on websphere 8.5

We are migrating our Web application from WAS5.1 (Java 1.4) to WAS8.5(Java 7) using Eclipse Oxygen and WAS Migration Toolkit plug in.
We are able to build and publish application successfully on WAS8.5 local server but while accessing home page of application, we are getting below error. We don't have any special setting at container level for WAS5.1 but not sure what is missing here.
Error 404: SRVE0190E: File not found: {0}.
I was getting this error when trying to run an EAR on the server using Eclipse. I couldn't find an answer so I deleted the EAR and the project from my computer and re-cloned the project and made a new EAR. Somehow everything worked fine after doing that.. not going to question it. The old "unplug and plug back in".
Please check the web.xml file. I faced same issue and found that web.xml was got overritten with some default values.Not sure how it happened.but changing it to old values was working fine.
Check the jsp pages and if any errors for jsp in web.xml also can cause issues

Axis Error unable to engage module addressing

I am using axis2 on Apache Tomcat. I am writing client side to consumer SOAP WS. I configured Eclipse to use Tomcat as a server and while executing that line
stub._getServiceClient().engageModule("addressing");
I was getting that error "unable to engage module addressing". To fix that issue I add following line in the VM arguments of run configuration
-Daxis2.repo="E:\axis2\repository"
Now I export my project as a war file and deploy it on the real server. But Now I am again getting the same error(I checked the log file). I don't know how to fix, can every one help me. Thanks
It got resolved on my side in the following way:
I had an outdated WEB-INF/modules/axis2-jaxws-mar*.mar or rather 2 versions of it and the classloader got the older one of it and AxisServlet didn't start altogether
java.lang.NoSuchMethodError: org.apache.axis2.engine.AxisConfiguration.getGlobalModules()Ljava/util/List;
at org.apache.axis2.jaxws.module.JAXWSModule.registerGlobalModule(JAXWSModule.java:51)

Error 500: java.lang.NoSuchMethodError: org/apache/commons/fileupload/FileUploadBase.isMultipartContent(

Error 500: java.lang.NoSuchMethodError: org/apache/commons/fileupload/FileUploadBase.isMultipartContent(Lorg/apache/commons/fileupload/RequestContext;)
This is the error that I found in Websphere but I don't get any error in Apache tomcat. If anybody having solution. please reply me fast.
I am using following jar:
1.) commons-fileupload-1.3.jar
2.) commons-io-2.4.jar
See 500 means simple there is some problem in servlet code.
you might done something wrong in your servlet code.
try with putting upgraded jar files.
and also put your code so that you have written.
A comment on this post helped me, so I'm writing it as an answer.
It may help to set the classloader policy on the server to "Multiple". To do this in Websphere, navigate as follows:
Log in to the Websphere console (typically http://localhost:9060/ibm/console/login.do)
Servers -> Server Types -> WebSphere application servers.
Select the server that your application is deployed on ("server1" by default)
In the section "Server-specific Application Settings", change the Classloader policy to "Multiple"
Click "OK", then "Save to the master configuration"
You may then need to restart the server before the changes take effect.

Problems loading saaj class library

I did my homework but still unable to find a solution to my problem. I created a WAR file through NetBeans which uses soap with attachments - saaj technology. As suggested, I include: saaj-impl.jar, saaj-ri.jar, saaj-api.jar in my project. However, when I "hot deploy" or place my WAR file into webapps directory I get the following exception:
java.lang.NoClassDefFoundError: com/sun/xml/messaging/saaj/soap/MessageFactoryImpl
source.pkg.SoapClient.sendSoapMessage(SoapClient.java:120)
source.pkg.Air.<init>(Air.java:233)
source.flightops.AirController.<init>(AirController.java:15)
servlets.ResultsDisplay.processRequest(ResultsDisplay.java:40)
servlets.ResultsDisplay.doGet(ResultsDisplay.java:91)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.ClassNotFoundException: com.sun.xml.messaging.saaj.soap.MessageFactoryImpl
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
source.pkg.SoapClient.sendSoapMessage(SoapClient.java:120)
source.pkg.Air.<init>(Air.java:233)
source.flightops.AirController.<init>(AirController.java:15)
servlets.ResultsDisplay.processRequest(ResultsDisplay.java:40)
servlets.ResultsDisplay.doGet(ResultsDisplay.java:91)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621
I tried to explicitly indicate classpath like so:
System.setProperty("java.class.path", wjp.getDataDir() + "/webapps/" + wjp.getAppContext() + "/WEB-INF/lib");
I did more research and tried to call a class loader:
try
{
Class.forName("com.sun.xml.messaging.saaj.soap.MessageFactoryImpl").getClassLoader();
}
catch (ClassNotFoundException ex)
{
Logger.getLogger(AirDriver.class.getName()).log(Level.SEVERE, null, ex);
}
But still the same exception as above. This is strange because when I restart the server, sometimes the app works fine - SOAP response received and results are shown, but only after I restart the server. This hints to the fact that saaj classes are somehow found when server is restarted? But, the problem is it must work when I "hot deploy" or place updated WAR into webapps directory without restarting. We cannot afford restarting production server each time WAR is updated.
Another weird issue, is after I restart server, launch this WAR app it works fine. However, other apps which use the same saaj class library throw this same exception! So it's either using this WAR app and others not working, or use other apps and this WAR app throws this exception. Is there some kind of limited saaj library sharing? I have never seen something like this before.
Please, could somebody help me with this very strange (and nasty) problem?
Thank you,
Victor.
The problem has been solved by re-implementing the app in the main web container i.e. ROOT/WEB-INF as opposed to as a separate portlet.

Categories