You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tuomas <tu...@mithlond.net> on 2007/08/13 19:41:24 UTC

suddenly I cannot run servlets anymore

Hi!

With the advice I got from
<http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-5.5.html>,
I successfully installed Tomcat 5.5 on my computer
(Ubuntu 7.04). I verified that I can a) start the
server, b) access my own HTML and JSP pages, and c)
compile and run simple servlets.

I created a development dir in my home directory, 
/home/tuope/src/web/servlets. I have created, too,
some shortcuts there:
catalina.sh -> /usr/local/bin/tomcat/bin/catalina.sh
shutdown.sh -> /usr/local/bin/tomcat/bin/shutdown.sh
startup.sh -> /usr/local/bin/tomcat/bin/startup.sh

Having done the tests mentioned above, I issued
$ sudo sh ./shutdown.sh
and then
$ sudo sh ./startup.sh

The result was that *I can no longer run any
servlets*. I get this message

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error
() that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Cannot allocate
servlet instance for path
/servlet/coreservlets.HelloServlet2

org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:389)

org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:134)

javax.servlet.http.HttpServlet.service(HttpServlet.java:690)

javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

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

java.lang.ClassLoader.defineClass(ClassLoader.java:620)

java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

java.net.URLClassLoader.defineClass(URLClassLoader.java:260)

java.net.URLClassLoader.access$000(URLClassLoader.java:56)

java.net.URLClassLoader$1.run(URLClassLoader.java:195)
	java.security.AccessController.doPrivileged(Native
Method)

java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	java.lang.ClassLoader.loadClass(ClassLoader.java:306)

sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
	java.lang.ClassLoader.loadClass(ClassLoader.java:251)

org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1274)

org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)

org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:370)

org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:134)

javax.servlet.http.HttpServlet.service(HttpServlet.java:690)

javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

note The full stack trace of the root cause is
available in the Apache Tomcat/5.5.23 logs.

I rebooted the computer. Didn't help.

$ echo $JAVA_HOME
/usr/lib/jvm/java-6-sun-1.6.0.00
$ echo $CLASSPATH
/usr/local/bin/tomcat/common/lib/jsp-api.jar:/usr/local/bin/tomcat/common/lib/servlet-api.jar:/home/tuope/src/web/servlets:.

Does anyone know what might be causing this odd
behavior? I am unarmed. :-(

Tuomas



-- 
tuope@mithlond.net
http://tuope.mithlond.net

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


RE: suddenly I cannot run servlets anymore

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Tuomas [mailto:tuope@mithlond.net] 
> Subject: RE: suddenly I cannot run servlets anymore
> 
> I got my copy from
> http://tomcat.apache.org/download-55.cgi.

That's the proper place.

> Can file permissions play a role here?

Yes.

> Should *.class file be executable (for instance, 755)?

No, they are not directly executable; they're simply read by the JVM.

> Should all the class files I put in
> /usr/local/bin/tomcat/shared/classes, be owned by
> root?

It's a bad idea to run Tomcat (or any application) as root - too much
potential for doing accidental damage.  Tomcat does need at least read
access to all files it will be accessing.

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


RE: suddenly I cannot run servlets anymore

Posted by Tuomas <tu...@mithlond.net>.
> Get rid of the CLASSPATH variable - it shouldn't be
> used.  (For that
> matter, it never should have been invented.)
> 
> Are you using a real Tomcat download, or some
> 3rd-party repackeged mess?

I got my copy from
http://tomcat.apache.org/download-55.cgi.

I shut down the computer, then turned it on again.
Issued 
$ sudo sh /usr/local/bin/tomcat/bin/startup.sh. Bingo.
EVERYTHING is working again. I dont know why.

Can file permissions play a role here? Should *.class
file be executable (for instance, 755)? (I run Linux
(Ubuntu 7.04).)

$ ls -ld apache-tomcat-5.5.23/
drwxr-xr-x 11 root root 4096 2007-08-13 19:11
apache-tomcat-5.5.23/

*.class file are owned by my user account (tuope). My
umask settings give them a '-rw-------' permission
mode by default. Should all the class files I put in
/usr/local/bin/tomcat/shared/classes, be owned by
root?

Thanks for your time!

Tuomas

-- 
tuope@mithlond.net
http://tuope.mithlond.net

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


RE: suddenly I cannot run servlets anymore

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Tuomas [mailto:tuope@mithlond.net] 
> Subject: suddenly I cannot run servlets anymore
> 
> $ echo $CLASSPATH
> /usr/local/bin/tomcat/common/lib/jsp-api.jar:/usr/local/bin/to
> mcat/common/lib/servlet-api.jar:/home/tuope/src/web/servlets:.

Get rid of the CLASSPATH variable - it shouldn't be used.  (For that
matter, it never should have been invented.)

Are you using a real Tomcat download, or some 3rd-party repackeged mess?

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