You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Ryan Olson <rd...@financialcontent.com> on 2002/12/03 04:29:16 UTC

Baffled by classpath problem

Hi all,

Ok, I'm pretty much begging for mercy here.. I dislike it when people ask FAQs 
on mailing lists as much as anyone, but I've spent hours reading the docs and 
trying to get the cactus tutorial to work and I'm just not getting anywhere. 
Basically I've got everything set up as described in the Tomcat-HOWTO, 
including having all the cactus jars copied into WEB-INF/lib. However, no 
matter how I try to run the test, whether by command line or though the web 
browser, I always end up with:

javax.servlet.ServletException: Error allocating a servlet instance
	at 
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:659)
	at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
[snip]

root cause

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
	at java.lang.ClassLoader.defineClass0(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
[...]

I've read and re-read the CLASSPATH howto, and I'm positive that I've got the 
HttpServlet class & company in both my client and server classpaths -- I even 
went ahead and put j2ee.jar in WEB-INF/lib and can verify that it's being 
deployed by Tomcat. 

Any help would be greatly appreciated.

Ryan Olson


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


Re: Baffled by classpath problem

Posted by Brian Coyner <gu...@yahoo.com>.
Try packaging the Cactus JAR files into your web application's WEB-INF/lib
directory. That's how I do it.

Brian


--- Ryan Olson <rd...@financialcontent.com> wrote:
> On Tuesday 03 December 2002 1:49 am, SainTiss wrote:
> > Hi,
> >
> > what exactly are you trying to do?
> > Get the simpleServlet sample to work using a browser?
> >
> > Or are you trying to get it to work using Ant and the junit task?
> 
> I've tried it both from the browser and the command line as described in the 
> TestRunner Howto, but I'm focusing on the browser since that's what should be
> 
> the easiest according to the Tomcat Howto.
> 
> At this point I've installed a clean version of tomcat 4.1.12-LE-jdk14 and 
> deployed the SampleServlet/TestSampleServlet classes as described in the 
> Tomcat Howto. I copied the cactus jars to $CATALINA_HOME/common/lib exactly 
> as described in the Tomcat Howto as well. Still, I always get the  
> java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet error when 
> accessing the corresponding URL as defined in web.xml (also straight from the
> 
> Howto). I am positive that servlet.jar exists only in 
> $CATALINA_HOME/common/lib (default Tomcat setup).
> 
> On Tuesday 03 December 2002 6:51 am, Wang, Kevin wrote:
> > Your message indicated that the "root cause" was
> > "java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet".
> >
> > This could mean either you do not have HttpServlet on your classpath (very
> > unlikely if your Tomcat was working properly before you attempted Cactus)
> > or you have duplicates of it on your classpath. Check your
> > <tomcat-root>/lib or <tomcat-root>/server/lib etc. in addition to your
> > WEB-INF/classes and WEB-INF/lib.
> 
> I've checked all the locations you've mentioned and HttpServlet is only in 
> $CATALINA_HOME/common/lib. Tomcat is being run from a root shell with no 
> CLASSPATH defined or exported. All other servlets work fine.
> 
> I've followed the documentation and Howtos verbatim on a clean Tomcat 
> installation and I can't for the life of me figure out what I'm doing 
> wrong... Anyone?
> 
> Thanks
> 
> Ryan Olson
> 
> > On Tue, 2002-12-03 at 04:29, Ryan Olson wrote:
> > > Hi all,
> > >
> > > Ok, I'm pretty much begging for mercy here.. I dislike it when people ask
> > > FAQs on mailing lists as much as anyone, but I've spent hours reading the
> > > docs and trying to get the cactus tutorial to work and I'm just not
> > > getting anywhere. Basically I've got everything set up as described in
> > > the Tomcat-HOWTO, including having all the cactus jars copied into
> > > WEB-INF/lib. However, no matter how I try to run the test, whether by
> > > command line or though the web browser, I always end up with:
> > >
> > > javax.servlet.ServletException: Error allocating a servlet instance
> > > 	at
> > > org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:65
> > >9) at
> > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve
> > >.java:214) [snip]
> > >
> > > root cause
> > >
> > > java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
> > > 	at java.lang.ClassLoader.defineClass0(Native Method)
> > > 	at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
> > > 	at
> > > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
> > > at java.net.URLClassLoader.defineClass(URLClassLoader.java:250) [...]
> > >
> > > I've read and re-read the CLASSPATH howto, and I'm positive that I've got
> > > the HttpServlet class & company in both my client and server classpaths
> > > -- I even went ahead and put j2ee.jar in WEB-INF/lib and can verify that
> > > it's being deployed by Tomcat.
> > >
> > > Any help would be greatly appreciated.
> > >
> > > Ryan Olson
> > >
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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


Re: Baffled by classpath problem

Posted by Ryan Olson <rd...@financialcontent.com>.
On Tuesday 03 December 2002 1:49 am, SainTiss wrote:
> Hi,
>
> what exactly are you trying to do?
> Get the simpleServlet sample to work using a browser?
>
> Or are you trying to get it to work using Ant and the junit task?

I've tried it both from the browser and the command line as described in the 
TestRunner Howto, but I'm focusing on the browser since that's what should be 
the easiest according to the Tomcat Howto.

At this point I've installed a clean version of tomcat 4.1.12-LE-jdk14 and 
deployed the SampleServlet/TestSampleServlet classes as described in the 
Tomcat Howto. I copied the cactus jars to $CATALINA_HOME/common/lib exactly 
as described in the Tomcat Howto as well. Still, I always get the  
java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet error when 
accessing the corresponding URL as defined in web.xml (also straight from the 
Howto). I am positive that servlet.jar exists only in 
$CATALINA_HOME/common/lib (default Tomcat setup).

On Tuesday 03 December 2002 6:51 am, Wang, Kevin wrote:
> Your message indicated that the "root cause" was
> "java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet".
>
> This could mean either you do not have HttpServlet on your classpath (very
> unlikely if your Tomcat was working properly before you attempted Cactus)
> or you have duplicates of it on your classpath. Check your
> <tomcat-root>/lib or <tomcat-root>/server/lib etc. in addition to your
> WEB-INF/classes and WEB-INF/lib.

I've checked all the locations you've mentioned and HttpServlet is only in 
$CATALINA_HOME/common/lib. Tomcat is being run from a root shell with no 
CLASSPATH defined or exported. All other servlets work fine.

I've followed the documentation and Howtos verbatim on a clean Tomcat 
installation and I can't for the life of me figure out what I'm doing 
wrong... Anyone?

Thanks

Ryan Olson

> On Tue, 2002-12-03 at 04:29, Ryan Olson wrote:
> > Hi all,
> >
> > Ok, I'm pretty much begging for mercy here.. I dislike it when people ask
> > FAQs on mailing lists as much as anyone, but I've spent hours reading the
> > docs and trying to get the cactus tutorial to work and I'm just not
> > getting anywhere. Basically I've got everything set up as described in
> > the Tomcat-HOWTO, including having all the cactus jars copied into
> > WEB-INF/lib. However, no matter how I try to run the test, whether by
> > command line or though the web browser, I always end up with:
> >
> > javax.servlet.ServletException: Error allocating a servlet instance
> > 	at
> > org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:65
> >9) at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve
> >.java:214) [snip]
> >
> > root cause
> >
> > java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
> > 	at java.lang.ClassLoader.defineClass0(Native Method)
> > 	at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
> > 	at
> > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
> > at java.net.URLClassLoader.defineClass(URLClassLoader.java:250) [...]
> >
> > I've read and re-read the CLASSPATH howto, and I'm positive that I've got
> > the HttpServlet class & company in both my client and server classpaths
> > -- I even went ahead and put j2ee.jar in WEB-INF/lib and can verify that
> > it's being deployed by Tomcat.
> >
> > Any help would be greatly appreciated.
> >
> > Ryan Olson
> >

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


Re: Baffled by classpath problem

Posted by SainTiss <sa...@gmx.net>.
Hi,

what exactly are you trying to do?
Get the simpleServlet sample to work using a browser?

Or are you trying to get it to work using Ant and the junit task?

Cheers,

Hans

On Tue, 2002-12-03 at 04:29, Ryan Olson wrote:
> Hi all,
> 
> Ok, I'm pretty much begging for mercy here.. I dislike it when people ask FAQs 
> on mailing lists as much as anyone, but I've spent hours reading the docs and 
> trying to get the cactus tutorial to work and I'm just not getting anywhere. 
> Basically I've got everything set up as described in the Tomcat-HOWTO, 
> including having all the cactus jars copied into WEB-INF/lib. However, no 
> matter how I try to run the test, whether by command line or though the web 
> browser, I always end up with:
> 
> javax.servlet.ServletException: Error allocating a servlet instance
> 	at 
> org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:659)
> 	at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
> [snip]
> 
> root cause
> 
> java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
> 	at java.lang.ClassLoader.defineClass0(Native Method)
> 	at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
> 	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
> 	at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
> [...]
> 
> I've read and re-read the CLASSPATH howto, and I'm positive that I've got the 
> HttpServlet class & company in both my client and server classpaths -- I even 
> went ahead and put j2ee.jar in WEB-INF/lib and can verify that it's being 
> deployed by Tomcat. 
> 
> Any help would be greatly appreciated.
> 
> Ryan Olson
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>