Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rror allocating a servlet instance.

Status
Not open for further replies.

christelles

Instructor
Apr 16, 2007
1
US
Hi,

Have been stucked on this problem for a week now!!! So any help would be appreciated!!!

I included the error I get in my browser, the localhost.
2007-04-08.log, the JAVA_HOME, startup.sh and web.xml when running a servlet called Login. The error is Error allocating a servlet instance.

Best,

Chris

echo $JAVA_HOME
/opt/java/jdk1.5.0_08

./startup.sh
Using CATALINA_BASE: /home/s07-cs389-s20/tomcat
Using CATALINA_HOME: /home/s07-cs389-s20/tomcat
Using CATALINA_TMPDIR: /home/s07-cs389-s20/tomcat/temp
Using JRE_HOME: /opt/java/jdk1.5.0_08

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 allocating a servlet instance

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
105)

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
868)
org.apache.coyote.http11.Http11BaseProtocol
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:
663)

org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:
527)

org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:
80)
org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:595)

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$100(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:268)
java.lang.ClassLoader.loadClass(ClassLoader.java:251)

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

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

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
105)

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
868)
org.apache.coyote.http11.Http11BaseProtocol
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:
663)

org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:
527)

org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:
80)
org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:595)

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

*** localhost.2007-04-08.log

Apr 8, 2007 1:22:42 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Apr 8, 2007 1:22:42 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Apr 8, 2007 1:22:42 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Apr 8, 2007 1:22:42 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Apr 8, 2007 1:22:57 PM org.apache.catalina.core.StandardWrapperValve
invoke
SEVERE: Allocate exception for servlet Login
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
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
1253)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
1187)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:
1027)
at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:
750)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
130)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
868)
at org.apache.coyote.http11.Http11BaseProtocol
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:
663)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:
527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:
80)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright 2004 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"
<web-app>
<servlet>
<servlet-class>apollo</servlet-class>
<servlet-name>apollo</servlet-name>
</servlet>
<servlet-mapping>
<servlet-name>apollo</servlet-name>
<url-pattern>/servlet/apollo</url-pattern>
</servlet-mapping>

<servlet>
<servlet-class>ShowBedrock</servlet-class>
<servlet-name>ShowBedrock</servlet-name>
</servlet>
<servlet-mapping>
<servlet-name>ShowBedrock</servlet-name>
<url-pattern>/servlet/ShowBedrock</url-pattern>
</servlet-mapping>

<servlet>
<servlet-class>HelloWorldServlet</servlet-class>
<servlet-name>HelloWorldServlet</servlet-name>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorldServlet</servlet-name>
<url-pattern>/servlet/HelloWorldServlet</url-pattern>
</servlet-mapping>

<servlet>
<servlet-class>Login</servlet-class>
<servlet-name>Login</servlet-name>
</servlet>
<servlet-mapping>
<servlet-name>Login</servlet-name>
<url-pattern>/servlet/Login</url-pattern>
</servlet-mapping>

<servlet>
<servlet-class>Logout</servlet-class>
<servlet-name>Logout</servlet-name>
</servlet>
<servlet-mapping>
<servlet-name>Logout</servlet-name>
<url-pattern>/servlet/Logout</url-pattern>
</servlet-mapping>

<servlet>
<servlet-class>Operation</servlet-class>
<servlet-name>Operation</servlet-name>
</servlet>
<servlet-mapping>
<servlet-name>Operation</servlet-name>
<url-pattern>/servlet/Operation</url-pattern>
</servlet-mapping>

</web-app>
 
It looks Tomcat cannot find the servlet-api.jar
Are you sure that /home/s07-cs389-s20/tomcat is CATALINA_HOME?
Please check if there is such file:
/home/s07-cs389-s20/tomcat/common/lib/servlet-api.jar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top