Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JRUN 3.1, can not instantiate servlet.

 
B. Gregory
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic