tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Venkatesh.B...@trilogy.com
Subject Re: Problem with classpaths
Date Mon, 15 Nov 2004 07:27:29 GMT
Hi,

First of all, thanks for the reply... U were right, I had two copies of 
servlet.jar, one in <CATALINA_HOME>/common/lib and one in 
<CATALINA_HOME>/webapps/<my application>/WEB-INF/lib/

However, I removed the copy present in <CATALINA_HOME>/webapps/<my 
application>/WEB-INF/lib/, but I still get NoClassDef found error for 
javax.servlet.http.HttpServlet... This problem seems to be strange. I've 
checked to ensure that servlet.jar is now present only in 
<CATALINA_HOME>/common/lib... Earlier I was playing around with setting 
CLASSPATH variable in (bin/catalina.sh)... but now, I've removed all the 
jars that I had added to the CLASSPATH environment variable... But still 
I'm facing with this problem. I've included the exception stack trace for 
your reference...

Regards,
Venkatesh

Exception stack trace:

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
                 at java.lang.ClassLoader.defineClass1(Native Method)
                 at 
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
                 at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
                 at 
java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
                 at 
java.net.URLClassLoader.access$100(URLClassLoader.java:56)
                 at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
                 at java.security.AccessController.doPrivileged(Native 
Method)
                 at 
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
                 at 
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
                 at 
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
                 at java.lang.ClassLoader.defineClass1(Native Method)
                 at 
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
                 at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
                 at 
java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
                 at 
java.net.URLClassLoader.access$100(URLClassLoader.java:56)
                 at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
                 at java.security.AccessController.doPrivileged(Native 
Method)
                 at 
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
                 at 
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
                 at 
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
                 at java.lang.ClassLoader.defineClass1(Native Method)
                 at 
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
                 at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
                 at 
java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
                 at 
java.net.URLClassLoader.access$100(URLClassLoader.java:56)
                 at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
                 at java.security.AccessController.doPrivileged(Native 
Method)
                 at 
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
                 at 
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
                 at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1355)
                 at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1289)
                 at 
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
                 at java.lang.ClassLoader.defineClass1(Native Method)
                 at 
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
                 at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
                 at 
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1679)
                 at 
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:968)
                 at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1409)
                 at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1289)
                 at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:885)
                 at 
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:668)
                 at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
                 at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                 at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                 at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                 at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                 at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                 at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
                 at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
                 at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                 at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
                 at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                 at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
                 at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                 at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                 at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
                 at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                 at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                 at 
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
                 at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
                 at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
                 at 
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
                 at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
                 at java.lang.Thread.run(Thread.java:595)





QM <qm300@brandxdev.net>
11/13/2004 08:02 PM
Please respond to "Tomcat Users List"

 
        To:     Tomcat Users List <tomcat-user@jakarta.apache.org>
        cc: 
        Subject:        Re: Problem with classpaths


On Sat, Nov 13, 2004 at 10:33:24AM +0530, Venkatesh.Babu@trilogy.com 
wrote:
: I've placed all my classes in 
: <CATALINA_HOME>/webapps/myapp/WEB-INF/classes
: I've placed all my jars including the jgl3.1.0.jar(that contains 
: com.objectspace.jgl.Sequence) in 
<CATALINA_HOME>/webapps/myapp/WEB-INF/lib
: 
: and all the other commonly used jars including the servlet.jar (contains 

: javax.servlet.http.HttpServlet) in <CATALINA_HOME>/common/lib/

Do you have two copies of servlet.jar (or another JAR file that contains
servlet classes) elsewhere?  That would cause all sorts of classloader
problems.


: If I don't include the servlet.jar in my CLASSPATH, I get a no class def 

: found error for HttpServlet and once I include servlet.jar, I get a 
: noclassdef found error for Sequence.

Be careful how you use the term CLASSPATH -- you don't set this variable
explicitly when you use Tomcat. Follow the guidelines and place JAR
files or classes under certain directories (e.g. {context}/WEB-INF/lib,
{tomcat}/common/lib, etc).



: Can anybody please tell me as to how 
: the CLASSPATH works for tomcat and what all should I include in 
: classpath... I would be grateful for the info u provide... This problem 
is 
: bugging me since the past 2 days :-(

There's a classloader doc on the Tomcat website.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message