Java servlet issue... Tomcat setup perhaps?

Java servlet issue... Tomcat setup perhaps?

Post by 6e » Wed, 20 Apr 2005 06:25:11

Hi thanks for reading.

Im having some difficutly getting a servlet to run on my tomcat server.

I am able to run JSP files, but I am new with servlets.

I compiled a basic hello world file into a war file, and deployed it in
the webapps directory (it installed itself into web_apps\MyApp
directory. I manually moved it to the directory structure outlined in
many many tutorials.

After moving the files, I was able to get the servlet recognized, only
now I am getting an error stating "javax.servlet.ServletException:
Cannot allocate servlet instance for path /servlet/MyApp"

I checked the classpath, it includes the path to my jdk, ".", and
supporting Tomcat files.

I created a web.xml file, and placed it into that directory as well it
is written as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
" ">

Any advice on things to check would be appreciated, I am stuck. I am
trying to work on this project for work and as time goes by I know that
this will become a much larger issue.

Thank you!

Java servlet issue... Tomcat setup perhaps?

Post by Wendy » Wed, 20 Apr 2005 10:02:11

Post the contents (filenames & directory structure) of your .war file. If
you want it to expand into a directory with a particular name under webapps
(not web_apps) then give the .war file that same name.

Since we cannot know what you moved where, the best thing is to start over,
get your .war file correct, and then it should work without moving files
around (which you would not want to do with a production webapp anyway.)

One thing I see is that your <servlet-class>MyApp</srvlet-class> is
missing the package name. It needs to have the fully qualified class name,
including the package. From the other error message, perhaps this should be