Quantcast

On my Webserver: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

On my Webserver: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet

Paul van Hoven
I just rented a server for providing an internet service. Before, i
developped the application on my local machine which is running mac os x
leopard. I also installed tomcat for testing my application. After
creating a war file i place the webapp in the CATALINA_HOME/webapps
folder on my local machine. After starting tomcat i can access the
webapp on http://localhost:8080/myapp. It runs fine and everything works
as expected. I also include all the necessary jars in the WEB-INF/lib
folder.

Okay so far so good, now, i copied the war file (that actually runs fine
on my local machine) to the server into the folder
CATALINA_HOME/webapps, as it should be done. Then, i start tomcat
6.0.20. The webserver starts fine and accessing it by entering
http://www.myaddress.com:8080 the tomcat welcome page is greeting. I
switch into the manager and it tells me that my app is loaded. But when
i click on the link to the deployed webapp i get an error 500 and the
following exception is thrown:

javax.servlet.ServletException: Error allocating a servlet instance
   
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
   
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
   
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
    java.lang.Thread.run(Thread.java:636)
root cause

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
    java.lang.ClassLoader.defineClass1(Native Method)
    java.lang.ClassLoader.defineClass(ClassLoader.java:637)
...

Actually i do not understand this. The environment variables are set as
follows:
/usr/local/apache-tomcat-6.0.20/bin# ./startup.sh
Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.20
Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.20
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.20/temp
Using JRE_HOME:       /usr/bin

But i also set the variables explicitly in my .bashrc by
export CATALINA_HOME=/usr/local/apache-tomcat-6.0.20
export CATALINA_BASE=/usr/local/apache-tomcat-6.0.20

I start tomcat with root privileges. Every other app like the ones in
http://www.myaddress.com:8080/examples/servlets/ are working fine. What
is causing this problem?

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: On my Webserver: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet

David Smith-2
What jars are in your webapp?  Did you include any that might duplicate
those distributed in the servlet-api.jar file?

--David

Paul van Hoven wrote:

> I just rented a server for providing an internet service. Before, i
> developped the application on my local machine which is running mac os
> x leopard. I also installed tomcat for testing my application. After
> creating a war file i place the webapp in the CATALINA_HOME/webapps
> folder on my local machine. After starting tomcat i can access the
> webapp on http://localhost:8080/myapp. It runs fine and everything
> works as expected. I also include all the necessary jars in the
> WEB-INF/lib folder.
>
> Okay so far so good, now, i copied the war file (that actually runs
> fine on my local machine) to the server into the folder
> CATALINA_HOME/webapps, as it should be done. Then, i start tomcat
> 6.0.20. The webserver starts fine and accessing it by entering
> http://www.myaddress.com:8080 the tomcat welcome page is greeting. I
> switch into the manager and it tells me that my app is loaded. But
> when i click on the link to the deployed webapp i get an error 500 and
> the following exception is thrown:
>
> javax.servlet.ServletException: Error allocating a servlet instance
>  
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>
>  
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>
>  
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>
>  
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>
>  
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>    java.lang.Thread.run(Thread.java:636)
> root cause
>
> java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
>    java.lang.ClassLoader.defineClass1(Native Method)
>    java.lang.ClassLoader.defineClass(ClassLoader.java:637)
> ...
>
> Actually i do not understand this. The environment variables are set
> as follows:
> /usr/local/apache-tomcat-6.0.20/bin# ./startup.sh
> Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.20
> Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.20
> Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.20/temp
> Using JRE_HOME:       /usr/bin
>
> But i also set the variables explicitly in my .bashrc by
> export CATALINA_HOME=/usr/local/apache-tomcat-6.0.20
> export CATALINA_BASE=/usr/local/apache-tomcat-6.0.20
>
> I start tomcat with root privileges. Every other app like the ones in
> http://www.myaddress.com:8080/examples/servlets/ are working fine.
> What is causing this problem?
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: On my Webserver: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet

Paul van Hoven
Thanks for the answer. Here's a list of all the jars that i include:

activation.jar
antlr-2.7.6.jar
c3p0-0.9.1.2.jar
commons-beanutils-1.8.0.jar
commons-codec-1.3.jar
commons-collections-3.2.1.jar
commons-fileupload-1.2.1.jar
commons-httpclient-3.1.jar
commons-io-1.4.jar
commons-lang-2.4.jar
commons-logging-1.1.1.jar
dom4j-1.6.1.jar
ejb3-persistence.jar
ezmorph-1.0.6.jar
gwt-maps.jar
gwt-reverse-geocoder-1.0.8.1.jar
gwt-servlet.jar
gwt-user.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-testing.jar
hibernate3.jar
javassist-3.4.GA.jar
json-lib-2.2.3-jdk15.jar
jstl.jar
jta-1.1.jar
log4j.jar
mail.jar
mysql-connector-java-5.0.5-bin.jar
sanselan.jar
slf4j-api-1.5.2.jar
slf4j-log4j12.jar
spring-webmvc.jar
spring.jar
standard.jar

I'm not sure if they duplicate things from the servlet-api.jar.


David Smith schrieb:

> What jars are in your webapp?  Did you include any that might duplicate
> those distributed in the servlet-api.jar file?
>
> --David
>
> Paul van Hoven wrote:
>  
>> I just rented a server for providing an internet service. Before, i
>> developped the application on my local machine which is running mac os
>> x leopard. I also installed tomcat for testing my application. After
>> creating a war file i place the webapp in the CATALINA_HOME/webapps
>> folder on my local machine. After starting tomcat i can access the
>> webapp on http://localhost:8080/myapp. It runs fine and everything
>> works as expected. I also include all the necessary jars in the
>> WEB-INF/lib folder.
>>
>> Okay so far so good, now, i copied the war file (that actually runs
>> fine on my local machine) to the server into the folder
>> CATALINA_HOME/webapps, as it should be done. Then, i start tomcat
>> 6.0.20. The webserver starts fine and accessing it by entering
>> http://www.myaddress.com:8080 the tomcat welcome page is greeting. I
>> switch into the manager and it tells me that my app is loaded. But
>> when i click on the link to the deployed webapp i get an error 500 and
>> the following exception is thrown:
>>
>> javax.servlet.ServletException: Error allocating a servlet instance
>>  
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>
>>  
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>>
>>  
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>>
>>  
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>>
>>  
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>>    java.lang.Thread.run(Thread.java:636)
>> root cause
>>
>> java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
>>    java.lang.ClassLoader.defineClass1(Native Method)
>>    java.lang.ClassLoader.defineClass(ClassLoader.java:637)
>> ...
>>
>> Actually i do not understand this. The environment variables are set
>> as follows:
>> /usr/local/apache-tomcat-6.0.20/bin# ./startup.sh
>> Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.20
>> Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.20
>> Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.20/temp
>> Using JRE_HOME:       /usr/bin
>>
>> But i also set the variables explicitly in my .bashrc by
>> export CATALINA_HOME=/usr/local/apache-tomcat-6.0.20
>> export CATALINA_BASE=/usr/local/apache-tomcat-6.0.20
>>
>> I start tomcat with root privileges. Every other app like the ones in
>> http://www.myaddress.com:8080/examples/servlets/ are working fine.
>> What is causing this problem?
>>
>>    
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: On my Webserver: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet

Caldarale, Charles R
> From: Paul van Hoven [mailto:[hidden email]]
> Subject: Re: On my Webserver: java.lang.NoClassDefFoundError:
> javax/servlet/http/HttpServlet
>
> gwt-servlet.jar

I have some recollection that the above jar is the trouble maker; take a look inside it.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: On my Webserver: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet

Juha Laiho
Caldarale, Charles R wrote:
>> From: Paul van Hoven [mailto:[hidden email]]
>> Subject: Re: On my Webserver: java.lang.NoClassDefFoundError:
>> javax/servlet/http/HttpServlet
>>
>> gwt-servlet.jar
>
> I have some recollection that the above jar is the trouble maker; take a look inside it.

Almost, but not quite.. I took an interest in this after seeing your response,
and found the following:
http://lkamal.blogspot.com/2007/07/jar-not-loaded-servletclass-gwt-tomcat.html

... which explains that gwt-user.jar is the problem, for which gwt-servlet.jar
is the correction. There's also a tutorial by the same author describing that
gwt-user.jar should be used for building and gwt-servlet.jar for deployment:
http://lkamal.blogspot.com/2008/09/java-gwt-servlets-web-app-tutorial.html
--
..Juha

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: On my Webserver: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet

Paul van Hoven
Yeah, that was it. Thanks for the great help. I deleted gwt-user.jar and
now it runs perfectly fine.


Juha Laiho schrieb:

> Caldarale, Charles R wrote:
>  
>>> From: Paul van Hoven [mailto:[hidden email]]
>>> Subject: Re: On my Webserver: java.lang.NoClassDefFoundError:
>>> javax/servlet/http/HttpServlet
>>>
>>> gwt-servlet.jar
>>>      
>> I have some recollection that the above jar is the trouble maker; take a look inside it.
>>    
>
> Almost, but not quite.. I took an interest in this after seeing your response,
> and found the following:
> http://lkamal.blogspot.com/2007/07/jar-not-loaded-servletclass-gwt-tomcat.html
>
> ... which explains that gwt-user.jar is the problem, for which gwt-servlet.jar
> is the correction. There's also a tutorial by the same author describing that
> gwt-user.jar should be used for building and gwt-servlet.jar for deployment:
> http://lkamal.blogspot.com/2008/09/java-gwt-servlets-web-app-tutorial.html
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: On my Webserver: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet

Christopher Schultz-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Paul,

On 7/26/2009 5:47 AM, Paul van Hoven wrote:
> Yeah, that was it. Thanks for the great help. I deleted gwt-user.jar and
> now it runs perfectly fine.

For a bit of background, the Servlet API classes are supposed to be
located in one place only: in the server's main library directory.
Loading classes from anywhere else could be ... confusing, thus this
prohibition.

The application server is supposed to veto any classes loading from a
webapp's ClassLoader that are defined in certain packages (such as
java.* and javax.* ; see section 9.7.2 of the 2.5 Servlet Spec).

If you try to load servlet-api-x.y.z.jar into Tomcat, it does in fact
veto these classes and tells you about it. I'm not sure why Tomcat would
have a problem with gwt-servlet.jar, honestly, but since it contains the
classes from the Servlet API, at least those classes will be prohibited
from loading.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkptsV0ACgkQ9CaO5/Lv0PAFdwCfZSFk/RibGkW3O3cXfMHi2DJd
a5QAn3MdFN5fgejNGzSbjm4sBmsJ5Iz4
=e5Z/
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...