This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Error 500 when compiling servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Error 500 when compiling servlet" Watch "Error 500 when compiling servlet" New topic
Author

Error 500 when compiling servlet

Martin Dinstuhl
Greenhorn

Joined: Sep 27, 2004
Posts: 1
It looks like it might be a classpath issue. How are you compiling - are you using an ant script or are you just calling javac from the shell?

If you are using a command-line call to javac be sure to include the full path to the .jar file (/com/blah/something/MyJar.jar).
Linda Pan
Ranch Hand

Joined: Sep 24, 2001
Posts: 96
I am using javac on the command line. I actually have compiled fine but when executing http://localhost/servlet/FAQBot, then I get the above mentioned error. I will try to figure out the classpath error issue. Yes, I do think there is something I'm missing.
Prathiba Kalirengan
Greenhorn

Joined: Aug 30, 2004
Posts: 12
check out whether the classes are present in the correct package structure inside the jar..and give the correct path with package information in the descriptors


SCJP 1.4<br />SCJA BETA
Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hey Linda,

Well...There are lot amny reasons for this error.

Try the following....

1. Package any classes that need to be.
2. Try packaging ur servlet.
3. The last would be to copy the servlet.jar and other jar if any files to ur Web-Inf\classes and try.

Get back to me after trying this.

Cheers,
Swamy
Richard Bradford
Ranch Hand

Joined: Apr 20, 2004
Posts: 48
Copy the jar that contains the "com/lotus/sametime/community/LoginListener"
class to the WEB-INF/lib folder.
Linda Pan
Ranch Hand

Joined: Sep 24, 2001
Posts: 96
What resolved that error was to copy all the JAR files that were referenced in the code to the "WEB-INF\lib" directory on Tomcat. I now have a different error:

message - HTTP method GET is not supported by this URL

description - The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).

I am trying to run a servlet that is found in an IBM book but was having problems getting it to run on Tomcat. Thank you all for replying!

I guess in addition to setting the classpath for in order to compile the servlet code, you also must include these in the Tomcat library (WEB-INF\lib directory) in order to run the servlet.
[ September 28, 2004: Message edited by: Linda Pan ]
Richard Bradford
Ranch Hand

Joined: Apr 20, 2004
Posts: 48
Does the servlet support get requests?
ie. does it have a doGet(.., ..) method?
Linda Pan
Ranch Hand

Joined: Sep 24, 2001
Posts: 96
Actually it should be fine that it doesn't have that method because the servlet should just log into a Lotus Sametime server as a bot (a user) for Instant Messaging. All the interaction is not in a web page but inside a chat window. Now ... if I could get the chat to work since the bot logs in fine.

The bot basically searches a Lotus Notes database for an answer to my question. I type in "what is your name?" and it should enter a predefined answer - "I am a FAQBot".
Linda Pan
Ranch Hand

Joined: Sep 24, 2001
Posts: 96
I am getting an error when tryint to compile a servlet. I think it can't find the .JAR file that contains the classes for "com/lotus/sametime/community/LoginListener", but it is listed in my classpath. I am compiling with Tomcat5 and jdk1.3.1_12.

Can anyone help?

Error is listed below:

exception

javax.servlet.ServletException: Cannot allocate servlet instance for path /servlet/FAQBot
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:388)
at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.NoClassDefFoundError: com/lotus/sametime/community/LoginListener
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:488)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:106)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:488)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:106)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:964)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:687)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:369)
at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


[ September 28, 2004: Message edited by: Linda Pan ]
Scott Dunbar
Ranch Hand

Joined: Sep 23, 2004
Posts: 245
Linda, does the error message really say "com/lotus/sametime/community/LoginListener" or does it say "com.lotus.sametime.community.LoginListener"? Perhaps you are doing a Class.forName() and this is a cut and paste error?


<a href="http://forums.hotjoe.com/forums/list.page" target="_blank" rel="nofollow">Java forums using Java software</a> - Come and help get them started.
Linda Pan
Ranch Hand

Joined: Sep 24, 2001
Posts: 96
Yes th error includes the slashes:
java.lang.NoClassDefFoundError: com/lotus/sametime/community/LoginListener

[ September 28, 2004: Message edited by: Linda Pan ]
Scott Dunbar
Ranch Hand

Joined: Sep 23, 2004
Posts: 245
Sorry, I was in space for a minute - NoClassDefFoundError does print slashes, and not dots.

As far as the rest, it appears that it only supports POST and so you can't hit it with a browser by default. If you have access, wget allows you to post data too. Do something like "wget --post-data 'user=foo&password=bar' http://your.server.name/yourServlet"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error 500 when compiling servlet
 
Similar Threads
Hi Servlet invoke error
Servlet running on Local host but throwing Exception on public server
Issue with FTP upload using org.apache.commons.net.ftp
Just new in crystal report XI
Class not found exception in struts with hibernate