Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

http error 500 ServletException: Cannot allocate servlet instance...  RSS feed

 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm getting an HTTP Status 500 - Internal server error when running a servlet called ServletSimplePublisher
I'm using tomcat 4.0.1. The error is somethin' like this:
exception
javax.servlet.ServletException: Cannot allocate servlet instance for path /openjms/servlet/ServletSimplePublisher
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:415)
at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
.
.
.
root cause
java.lang.NoClassDefFoundError: ServletSimplePublisher (wrong name: openjms/examples/client/console/ServletSimplePublisher)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:493)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
.
.
.
any ideas
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need the following file in the place indicated:
WEB-INF/classes/openjms/examples/client/console/ServletSimplePublisher.class
or for Windows, its backslashed equivalent.
And the name of the class file and all its parent directories up to and including "WEB-INF" MUST be capitalized exactly as shown. Even though the Windows filesystem is case-independent, Java has other ideas.
The JAR equivalent would be:
openjms/examples/client/console/ServletSimplePublisher.class
Within a jar in WEB-INF/lib
Also properly capitalized.
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thx Tim.
I've put the file where you said, so it looks something like this:
tomcat/webapps/openjms
tomcat/webapps/openjms/build
tomcat/webapps/openjms/dist
tomcat/webapps/openjms/META-INF
tomcat/webapps/openjms/META-INF/MANIFEST.FM
tomcat/webapps/openjms/servlets
tomcat/webapps/openjms/servlets/ServletSimplePublisher.class
tomcat/webapps/openjms/servlets/SimplePublisher.html
tomcat/webapps/openjms/WEB-INF/classes/openjms/examples/client/console
/ServletSimplePublisher.class
tomcat/webapps/openjms/WEB-INF/lib
tomcat/webapps/openjms/WEB-INF/src
am I still missing something?
thanks in advance.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
remove the class file from the /servlets directory. It might be finding that one first, and using it (which would be wrong).. and what is your /servlets directory for anyways?

HTML should be served out of your openjms directory
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it mike, now it's working. thanks a lot!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!