1

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

Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
Ololade enifeni
  • 111
  • 3
  • 7
  • 15
  • have you checked the FFDC logs of the application server? It should provide more relevant information in debugging your issue. – Renan Nov 02 '11 at 10:44

4 Answers4

5

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

Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
  • I do not think it is bundled with the app by default. Is there any other way to know if it is bunled apart from checking the libraries in netbeans because i checked it and it is not bundled with it. – Ololade enifeni Sep 08 '11 at 10:57
  • I have bundled servlet-api.jar with the project and redeployed to websphere but i am having this error still. Any more ideas? – Ololade enifeni Sep 08 '11 at 12:20
  • i have removed it but still have the same error. Do you think it's version problem? – Ololade enifeni Sep 08 '11 at 13:30
  • ServletInputStream has been there for a long time, so it shouldn't be. It looks like a classloader problem. Can you try deploying it to a separate tomcat instance? – Bozho Sep 08 '11 at 13:32
  • i developed and deployed it with glassfish and i'm tying to deploy with websphere which is what i am having issues with – Ololade enifeni Sep 08 '11 at 13:36
  • try upgrading your websphere. Honestly, those app servers are so buggy and that's the reason I've rarely used them. – Bozho Sep 08 '11 at 13:50
  • What jars are you deploying? I'd guess you're deploying another one (or more) which you shouldn't be, which is causing the classloader to look in the wrong place for dependent classes. – dbreaux Sep 08 '11 at 13:55
  • apart from the servlet-api, you should exclude jsp and el jars – Bozho Sep 08 '11 at 13:57
  • @dbreaux, it's a jersey webservice. – Ololade enifeni Sep 08 '11 at 14:00
  • Really guys, i don't know what else to do. nothing still – Ololade enifeni Sep 08 '11 at 14:26
  • 1
    But which other jars are you deploying with the app? Can you list them all? If you're deploying Jersey copies of anything that WAS already provides, you are probably confusing the classloader. Worst case, you can try switching WAS to parent_last classloading, but if you can instead remove any duplicated classes, that will be safer and simpler. – dbreaux Sep 08 '11 at 15:58
  • @dbreaux, i also tried a simple web app and the same thing happens. Or is it having issues with sun-web.xml? – Ololade enifeni Sep 09 '11 at 13:57
  • I would expect sun-web.xml to be ignored. How simple of an app are you deploying? If you're deploying no jars at all and this error is still occurring, you might need to contact IBM support afterall. That would seem like a basic installation problem. Are the WebSphere sample applications installed & working? – dbreaux Sep 09 '11 at 17:20
  • @dbreaux, i even ignored deploying the major applications itself and created a jsp page and the same thing happens – Ololade enifeni Sep 12 '11 at 09:25
1

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.

Mazahir
  • 11
  • 1
1

I did below steps which worked for me :

  1. Go to the server in console(which was stand - alone in my case i.e no DMGR)
  2. Change the class loader policy to "multiple".
Jon Egerton
  • 40,401
  • 11
  • 97
  • 129
Mukund
  • 11
  • 1
  • That's a workaround, not a solution. You still need to remove the container-specific libraries from the webapp's `/WEB-INF/lib`. – BalusC Jan 20 '12 at 12:08
-1

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

Santosh
  • 17,667
  • 4
  • 54
  • 79
  • 4
    it is already bundled with the app server. You must _not_ have it bundled with the application – Bozho Sep 08 '11 at 10:50
  • @Bozho, I agree with you, but I found similar issue while working JBoss. As a work around I simply bundled the jar file in war and it work. But I am still curious to know why it was happening. – Santosh Sep 08 '11 at 10:52
  • 1
    if the jar is not bundled with the app server, then the app server does not conform to the spec.. :) – Bozho Sep 08 '11 at 10:53
  • Well that's least likely :). But I see some dirty classloading issue here. – Santosh Sep 08 '11 at 10:57
  • where do i locate the servlet-api.jar file? – Ololade enifeni Sep 08 '11 at 11:01
  • I have bundled servlet-api.jar with the project and redeployed to websphere but i am having this error still. Any more ideas? – Ololade enifeni Sep 08 '11 at 12:21
  • @Ololade, right now I cannot figure out your problem. will post in case I find anything. – Santosh Sep 08 '11 at 13:27