wood burning stoves*
The moose likes Servlets and the fly likes JRUN 3.1, can not instantiate servlet. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "JRUN 3.1, can not instantiate servlet." Watch "JRUN 3.1, can not instantiate servlet." New topic
Author

JRUN 3.1, can not instantiate servlet.

B. Gregory
Greenhorn

Joined: Nov 05, 2003
Posts: 6
Guys this is my first real crack at a servlet. I'm getting a can not instantiate servlet error. Any insights as to what I should look at would help speed me up. Not sure where to look first.
Thanks in advance,
Jayson Falkner
Author
Ranch Hand

Joined: May 07, 2001
Posts: 57
There could be lots of things. Are you putting your servlet code in the WEB-INF/classes folder of your web application, and are you deploying it in the web.xml file for the same web application? If so, send in more info about what exactly you tried, and we'll see about getting your servlet working.


Jayson Falkner<br />jayson@jspinsider.com<br />Author of <a href="http://www.jspbook.com" target="_blank" rel="nofollow">Servlets and JavaServer Pages; the J2EE Web Tier</a>
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
This error can happen if you don't have all the classes needed for your servlet available to the servlet container, even though they were available to the compiler when you compiled your code.
Servlet containers almost always ignore any external "classpath", and only recognize and load classes deployed within their own configuration and application structure. Typically you should ensure that your own application classes are placed in WEB-INF/classes, and that any third-party jar files needed by your code are placed in WEB-INF/lib.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12825
    
    5
For one thing, JRun 3.1 is a couple of years old and does not support the current servlet API, so there might be an incompatibility there. Is there some reason you have to use JRun 3.1 as opposed to - say - Tomcat 4?
Are you using the JRun manager to deploy the servlet?
In any case there should be something informative in the log files.
Bill
B. Gregory
Greenhorn

Joined: Nov 05, 2003
Posts: 6
Thank you for all the informative answers. I should have given a clearer picture. I have since found the batch file that compiles all files within JRUN and I have added my servlet to the web-inf.xml file. The problem that I am now running into is that I am using a 3rd party JAR file to create PDF forms, itext.jar. When I place this within the web-inf/lib directory, I am still not able to access the files within. I believe I need to add the JAR file directly to the class path. I am receiving a 500 internal server error. I would appreciate any help. Again, thank you all.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
It's a while since I last used an older version of the servlet API, but I have this vague memory that there was no notion of WEB-INF/lib.
Have you tried simply unzipping the third-party jsr into wherever you have located your own application class files?
B. Gregory
Greenhorn

Joined: Nov 05, 2003
Posts: 6
The servlet is in the WEB-INF/classes directory, and has been. You were right about the servlet container not seeing the third party external classpath. I have since included the path to the jar file in the JRUN classpath and I am now receiving errors to the effect, "package does not exist" from within the jar directory structure. Please shed some pearls of wisdom.
B. Gregory
Greenhorn

Joined: Nov 05, 2003
Posts: 6
Thank you for all the responses. I have come to find that a different jar file from iText was loaded than the one I was using. Hence, all is well now. Again, thank you all.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JRUN 3.1, can not instantiate servlet.