• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JRUN 3.1, can not instantiate servlet.

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Author
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
No matter how many women are assigned to the project, a pregnancy takes nine months. Much longer than this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic