You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alastair Baldwin <al...@yahoo.co.uk> on 2012/01/10 19:28:05 UTC

SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

Dear users

I'm unable to get a Hello World Servlet running from my browser. 

Configuration:
Windows XP Version 2002 service pack 3
Apache-tomcat-7.0.23-windows-x86
CATALINA_HOME = c:\apache-tomcat-7.0.23-windows-x86\apache-tomcat-7.0.23
CLASSPATH= .;c:\apache-tomcat-7.0.23-windows-x86\apache-tomcat-7.0.23\servlet-api.jar 
 JAVA_HOME=c:\Program Files\jdk1.7.0


compiling as javac HelloWorldServlet.java -cp CATALINA_HOME/lib/servlet-api.jar 

I manually copy  HelloWorldServlet.class  to the apress directory under webapps

and the web.xml to webapps/apress/WEB-INF

I start Tomcat from CATALINA_HOME\bin as catalina start

I get the following output:
Jan 09, 2012 12:40:51 AM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory C:\apache-tomcat-7.0.23-windows-x86\apache-tomcat-7.0.23\webapps\apress 
INFO: Server startup in 1017 ms 


In Google chrome I type: 
http://localhost:8080/apress/hello.html

I get the following output in my browser: 


-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: Error instantiating servlet class HelloWorldServlet 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)  


and this is the logs: 

INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@4ded8e') 
Jan 09, 2012 12:40:49 PM org.apache.catalina.core.ApplicationContext log 
INFO: Marking servlet helloworld as unavailable 
Jan 09, 2012 12:40:49 PM org.apache.catalina.core.StandardWrapperValve invoke 
SEVERE: Allocate exception for servlet helloworld 
java.lang.ClassNotFoundException: HelloWorldServlet 
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)  



Thanks in advance

Alastair  

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


Re: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

Posted by Alastair Baldwin <al...@yahoo.co.uk>.
That was it, I can't believe it was so trivial.

Thank you so much

Alastair


----- Original Message -----
From: Mark Thomas <ma...@apache.org>
To: Tomcat Users List <us...@tomcat.apache.org>
Cc: 
Sent: Tuesday, 10 January 2012, 19:24
Subject: Re: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

On 10/01/2012 19:20, Mark Thomas wrote:
> On 10/01/2012 19:14, Alastair Baldwin wrote:
>> My HelloWorldServlet.class is in CATALINA_HOME/webapps/WEB-INF/Classes
> 
> Which should be:
> CATALINA_HOME/webapps/WEB-INF/classes

Scratch that. It should be:
CATALINA_HOME/webapps/<appname>/WEB-INF/classes

Mark

---------------------------------------------------------------------
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: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

Posted by Mark Thomas <ma...@apache.org>.
On 10/01/2012 19:20, Mark Thomas wrote:
> On 10/01/2012 19:14, Alastair Baldwin wrote:
>> My HelloWorldServlet.class is in CATALINA_HOME/webapps/WEB-INF/Classes
> 
> Which should be:
> CATALINA_HOME/webapps/WEB-INF/classes

Scratch that. It should be:
CATALINA_HOME/webapps/<appname>/WEB-INF/classes

Mark

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


Re: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

Posted by Mark Thomas <ma...@apache.org>.
On 10/01/2012 19:14, Alastair Baldwin wrote:
> My HelloWorldServlet.class is in CATALINA_HOME/webapps/WEB-INF/Classes

Which should be:
CATALINA_HOME/webapps/WEB-INF/classes

Case matters.

Mark

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


Re: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

Posted by Alastair Baldwin <al...@yahoo.co.uk>.
My HelloWorldServlet.class is in CATALINA_HOME/webapps/WEB-INF/Classes

Alastair


----- Original Message -----
From: Mark Thomas <ma...@apache.org>
To: Tomcat Users List <us...@tomcat.apache.org>
Cc: 
Sent: Tuesday, 10 January 2012, 18:41
Subject: Re: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

On 10/01/2012 18:38, Alastair Baldwin wrote:
> Excuse my ignorance, but I had the package information in place and had the same error
> so I tried to simplify it by removing the package details from HelloWorldServlet.java
> and the webapps directory. Is a package essential for tomcat to work?

Using packages is strongly recommended.

Placing classes under WEB-INF/classes is required.

Mark

---------------------------------------------------------------------
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: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

Posted by Mark Thomas <ma...@apache.org>.
On 10/01/2012 18:38, Alastair Baldwin wrote:
> Excuse my ignorance, but I had the package information in place and had the same error
> so I tried to simplify it by removing the package details from HelloWorldServlet.java
> and the webapps directory. Is a package essential for tomcat to work?

Using packages is strongly recommended.

Placing classes under WEB-INF/classes is required.

Mark

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


Re: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

Posted by Alastair Baldwin <al...@yahoo.co.uk>.
Excuse my ignorance, but I had the package information in place and had the same error
so I tried to simplify it by removing the package details from HelloWorldServlet.java
and the webapps directory. Is a package essential for tomcat to work?


----- Original Message -----
From: Mark Thomas <ma...@apache.org>
To: Tomcat Users List <us...@tomcat.apache.org>
Cc: 
Sent: Tuesday, 10 January 2012, 18:30
Subject: Re: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

On 10/01/2012 18:28, Alastair Baldwin wrote:
> Dear users
> 
> I'm unable to get a Hello World Servlet running from my browser. 
> 
> Configuration:
> Windows XP Version 2002 service pack 3
> Apache-tomcat-7.0.23-windows-x86
> CATALINA_HOME = c:\apache-tomcat-7.0.23-windows-x86\apache-tomcat-7.0.23
> CLASSPATH= .;c:\apache-tomcat-7.0.23-windows-x86\apache-tomcat-7.0.23\servlet-api.jar 
>  JAVA_HOME=c:\Program Files\jdk1.7.0
> 
> 
> compiling as javac HelloWorldServlet.java -cp CATALINA_HOME/lib/servlet-api.jar 
> 
> I manually copy  HelloWorldServlet.class  to the apress directory under webapps

That should be apress/WEB-INF/classes/<package
structure>/HelloWorldServlet.class

Mark

---------------------------------------------------------------------
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: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

Posted by Mark Thomas <ma...@apache.org>.
On 10/01/2012 18:28, Alastair Baldwin wrote:
> Dear users
> 
> I'm unable to get a Hello World Servlet running from my browser. 
> 
> Configuration:
> Windows XP Version 2002 service pack 3
> Apache-tomcat-7.0.23-windows-x86
> CATALINA_HOME = c:\apache-tomcat-7.0.23-windows-x86\apache-tomcat-7.0.23
> CLASSPATH= .;c:\apache-tomcat-7.0.23-windows-x86\apache-tomcat-7.0.23\servlet-api.jar 
>  JAVA_HOME=c:\Program Files\jdk1.7.0
> 
> 
> compiling as javac HelloWorldServlet.java -cp CATALINA_HOME/lib/servlet-api.jar 
> 
> I manually copy  HelloWorldServlet.class  to the apress directory under webapps

That should be apress/WEB-INF/classes/<package
structure>/HelloWorldServlet.class

Mark

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


Re: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

Posted by Alastair Baldwin <al...@yahoo.co.uk>.
Sorry that was a typo


----- Original Message -----
From: Pid <pi...@pidster.com>
To: Tomcat Users List <us...@tomcat.apache.org>
Cc: 
Sent: Tuesday, 10 January 2012, 20:00
Subject: Re: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

On 10/01/2012 18:34, Caldarale, Charles R wrote:
>> From: Alastair Baldwin [mailto:alastairgbaldwin@yahoo.co.uk] 
>> Subject: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23
> 
>> CLASSPATH= .;c:\apache-tomcat-7.0.23-windows-x86\apache-tomcat-7.0.23\servlet-api.jar 
> 
> Probably not the cause of your problem, but don't set the CLASSPATH variable - ever.  It's guaranteed to cause confusion for unsuspecting programs that don't know how to protect themselves from such abuse.  (Fortunately, the standard Tomcat startup scripts usually do handle it properly by ignoring the variable.)

... and that URL is unlikely to work anyway, unless you've got a really
broken Tomcat.  (It's missing a 'lib' directory in the path.)


p


>  - 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
> 


-- 

[key:62590808]

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


Re: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

Posted by Pid <pi...@pidster.com>.
On 10/01/2012 18:34, Caldarale, Charles R wrote:
>> From: Alastair Baldwin [mailto:alastairgbaldwin@yahoo.co.uk] 
>> Subject: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23
> 
>> CLASSPATH= .;c:\apache-tomcat-7.0.23-windows-x86\apache-tomcat-7.0.23\servlet-api.jar 
> 
> Probably not the cause of your problem, but don't set the CLASSPATH variable - ever.  It's guaranteed to cause confusion for unsuspecting programs that don't know how to protect themselves from such abuse.  (Fortunately, the standard Tomcat startup scripts usually do handle it properly by ignoring the variable.)

... and that URL is unlikely to work anyway, unless you've got a really
broken Tomcat.  (It's missing a 'lib' directory in the path.)


p


>  - 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
> 


-- 

[key:62590808]


RE: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Alastair Baldwin [mailto:alastairgbaldwin@yahoo.co.uk] 
> Subject: SEVERE: Allocate exception for servlet helloworld Apache-Tomcat 7.0.23

> CLASSPATH= .;c:\apache-tomcat-7.0.23-windows-x86\apache-tomcat-7.0.23\servlet-api.jar 

Probably not the cause of your problem, but don't set the CLASSPATH variable - ever.  It's guaranteed to cause confusion for unsuspecting programs that don't know how to protect themselves from such abuse.  (Fortunately, the standard Tomcat startup scripts usually do handle it properly by ignoring the variable.)

 - 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