Java servlet issue... Tomcat setup perhaps?

Discussion in 'Java' started by 6e, Apr 18, 2005.

  1. 6e

    6e Guest

    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"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
    <servlet>
    <servlet-name>MyApp</se­rvlet-name>
    <servlet-class>MyApp</s­ervlet-class>
    <load-on-startup>1</load-on-st­artup>
    </servlet>
    <servlet-mapping>
    <servlet-name>MyApp</servlet-name>
    <url-pattern>/MyApp</ur­l-pattern>
    </servlet-mapping>
    </web-app>

    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!
    6e, Apr 18, 2005
    #1
    1. Advertising

  2. 6e

    Wendy S Guest

    "6e" <> wrote:

    > 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.


    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</s­ervlet-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
    servlet.MyApp?

    --
    Wendy
    Wendy S, Apr 19, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sean Clarke
    Replies:
    1
    Views:
    1,893
    Sudsy
    Jan 7, 2004
  2. circuit_breaker
    Replies:
    2
    Views:
    1,996
    Jack Jia
    Apr 4, 2004
  3. Doug McCann
    Replies:
    1
    Views:
    1,005
    William Brogden
    Aug 5, 2004
  4. Replies:
    0
    Views:
    844
  5. pompair
    Replies:
    0
    Views:
    749
    pompair
    Jan 27, 2008
Loading...

Share This Page