You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ladislav Gaspar <la...@it-vision.com> on 2009/02/02 08:33:21 UTC

AW: NoClassDefFoundError: HttpServlet

Sorry for the misinformation. The the servlet-api.jar is in  $catalina_home/lib. The %CLASSPATH% is not adjusted
I start tomcat with the bat file and when tomcat tries to load the first servlet I get the following error (see below). It's from
the catalina.<date>.log file
Thanks
Laci

SCHWERWIEGEND: Error deploying configuration descriptor ITVHealthGate.xml
java.lang.NoClassDefFoundError: HttpServlet
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at java.security.SecureClassLoader.defineClass(Unknown Source)
	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)
	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at java.security.SecureClassLoader.defineClass(Unknown Source)
	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)
	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at java.security.SecureClassLoader.defineClass(Unknown Source)
	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)
	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at java.security.SecureClassLoader.defineClass(Unknown Source)
	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)
	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1083)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4045)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4351)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)



-----Ursprüngliche Nachricht-----
Von: Konstantin Kolinko [mailto:knst.kolinko@gmail.com] 
Gesendet: Freitag, 30. Januar 2009 16:41
An: Tomcat Users List
Betreff: Re: NoClassDefFoundError: HttpServlet

2009/1/30 Ladislav Gaspar <la...@it-vision.com>:
>
>
> As I wrote in the original post
>>(I've cleaned up the classpath, there are no duplicate servlet-api.jar 
>>files around)
>
> The servlet-api.jar is there and it's also in the classpath. (in 
> $catalina_home/lib)
>

I do not understand.  "is there and it's also"  It should be in one place exactly. And it should NOT be mentioned in any %CLASSPATH% variable (you should not adjust %CLASSPATH%, as it breaks classloading hierarchy).

Also, how you are starting Tomcat (service? bat file? from inside an IDE ?), and at what exact moment (at what step?, what you are doing?) the message is displayed?


Also, the stacktrace that you cited - is it from the log file?

Can you provide a longer stacktrace? I am wondering where that class loading is called from.



Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


AW: NoClassDefFoundError: HttpServlet

Posted by Ladislav Gaspar <la...@it-vision.com>.
oh gosh, how embarrassing...
Someone had changed the default output folder for the compiled classes but my ant scripts still deployed
from the old (and now wrong) location...

sorry for bothering ye, and thanks for the replies.

cheers
Laci



---------------------------------------------------
Laci Gaspar                 T. +41 61 206 9617
Senior Professional         www.it-vision.com
portX Technik               www.portx.ch

IT Vision AG
St. Alban-Anlage 29         Technoparkstrasse 1	
4010 Basel                  8005 Zürich
---------------------------------------------------

-----Ursprüngliche Nachricht-----
Von: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Gesendet: Dienstag, 3. Februar 2009 16:07
An: Tomcat Users List
Betreff: RE: NoClassDefFoundError: HttpServlet

> From: Ladislav Gaspar [mailto:ladislav.gaspar@it-vision.com]
> Subject: AW: NoClassDefFoundError: HttpServlet
>
> The sample servlets work.

Good - which says the problem is isolated to your webapp, so that narrows the focus.

> But what could that be?

It looks like somewhere in your webapp, you're carrying around a second copy of HttpServlet.  You'll need to go through all your jars, looking for classes that duplicate ones that Tomcat provides.  Also look in the META-INF/MANIFEST.MF entries of each jar, to see if there's a Class-Path entry that links to other jars it shouldn't.

 - 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: NoClassDefFoundError: HttpServlet

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Ladislav Gaspar [mailto:ladislav.gaspar@it-vision.com]
> Subject: AW: NoClassDefFoundError: HttpServlet
>
> The sample servlets work.

Good - which says the problem is isolated to your webapp, so that narrows the focus.

> But what could that be?

It looks like somewhere in your webapp, you're carrying around a second copy of HttpServlet.  You'll need to go through all your jars, looking for classes that duplicate ones that Tomcat provides.  Also look in the META-INF/MANIFEST.MF entries of each jar, to see if there's a Class-Path entry that links to other jars it shouldn't.

 - 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


AW: NoClassDefFoundError: HttpServlet

Posted by Ladislav Gaspar <la...@it-vision.com>.
The sample servlets work. 
You say that the problem must be in my webapp. But what could that be?

Laci


-----Ursprüngliche Nachricht-----
Von: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Gesendet: Montag, 2. Februar 2009 20:47
An: Tomcat Users List
Betreff: RE: NoClassDefFoundError: HttpServlet

> From: Ladislav Gaspar [mailto:ladislav.gaspar@it-vision.com]
> Subject: AW: NoClassDefFoundError: HttpServlet
>
> Sorry for the misinformation. The the servlet-api.jar is in 
> $catalina_home/lib. The %CLASSPATH% is not adjusted

The symptoms are still identical with those that appear when servlet-api.jar is in WEB-INF/lib or otherwise appears in multiple places in a given branch of the classloader tree.  Note that the conflicting servlet classes might also be hidden inside a jar of a different name, such as j2ee.jar.

Do the sample servlet and JSP apps that come with Tomcat work?  If so, the problem is inside your webapp; if not, then there's another copy of the servlet classes lurking somewhere visible to Tomcat, perhaps in the endorsed directory.

 - 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: NoClassDefFoundError: HttpServlet

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Ladislav Gaspar [mailto:ladislav.gaspar@it-vision.com]
> Subject: AW: NoClassDefFoundError: HttpServlet
>
> Sorry for the misinformation. The the servlet-api.jar is in
> $catalina_home/lib. The %CLASSPATH% is not adjusted

The symptoms are still identical with those that appear when servlet-api.jar is in WEB-INF/lib or otherwise appears in multiple places in a given branch of the classloader tree.  Note that the conflicting servlet classes might also be hidden inside a jar of a different name, such as j2ee.jar.

Do the sample servlet and JSP apps that come with Tomcat work?  If so, the problem is inside your webapp; if not, then there's another copy of the servlet classes lurking somewhere visible to Tomcat, perhaps in the endorsed directory.

 - 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org