You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Antonie C Malan <ma...@optusnet.com.au> on 2002/11/13 14:07:44 UTC

Problem when accessing a servlet

Hi All,

I had a very unusual problem.  When accessing the servlet in Tomcat from the 
browser the following is produced (only a bit following root cause pasted):

root cause
java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
	at java.lang.ClassLoader.defineClass0(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:54

Now HttpServlet is in the servlet.jar which is in 
/usr/local/tomcat-4.1.12/common/lib.  I even copied 
servlet.jar to the lib directory under WEB-INF - no go.  
Eventually I had both servlet.jar and velocity-dep-1.3.1-rc2.jar in 
/usr/local/tomcat-4.1.12/common/lib and added both to the classpath.
This seemed to cure the problem.  My question is, which jars need to be in the 
classpath and which should be in which directories?  As I understand it, 
having jars in /usr/local/tomcat-4.1.12/common/lib makes them accessible to 
both Tomcat and servlets using Tomcat.  Is this correct?

It is only with Velocity servlets that I had this problem.  JSPs and other 
servlets had no problems.

Please let me know what goes where so I don't spend days with a problem like 
this again.

Thanks very much,

Chris Malan
malan2000@optusnet.com.au

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>