URGENT: javax.servlet.ServletException: Wrapper cannot find servlet

Discussion in 'Java' started by dami.gupta@gmail.com, Apr 3, 2007.

  1. Guest

    Hello,
    This is a newbie question. Any help would be MUCH appreciated.

    I am using JBoss. My servlet, HelloServlet, prints a simple Hello
    statement. I create a hello.war file with files

    welcome.html
    META-INF/Manifest.mf
    WEB-INF/web.xml
    WEB-INF/classes/HelloServlet.class


    web.xml is as -

    <?xml version="1.0"?>

    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
    Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" >

    <web-app>
    <servlet>
    <servlet-name>HelloServlet</servlet-name>
    <servlet-class>hello.HelloServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloServlet</servlet-name>
    <url-pattern>/HelloServlet/*</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>welcome.html</welcome-file>
    </welcome-file-list>
    </web-app>

    I place the hello.war in the jboss/server/default/deploy directory.
    JBoss starts up fine saying that the war file has been deployed.
    In my browser, I type
    http://localhost:8080/hello/welcome.html
    This works fine.

    However when I do
    http://localhost:8080/hello/HelloServlet

    I get
    "javax.servlet.ServletException: Wrapper cannot find servlet class
    hello.HelloServlet or a class it depends on"
    and so on.
    I have been following the SAMS Teach yourself EJB book.

    Please help. Thanks, DG
    , Apr 3, 2007
    #1
    1. Advertising

  2. vishist Guest

    On Apr 2, 11:49 pm, wrote:
    > Hello,
    > This is a newbie question. Any help would be MUCH appreciated.
    >
    > I am using JBoss. My servlet, HelloServlet, prints a simple Hello
    > statement. I create a hello.war file with files
    >
    > welcome.html
    > META-INF/Manifest.mf
    > WEB-INF/web.xml
    > WEB-INF/classes/HelloServlet.class
    >
    > web.xml is as -
    >
    > <?xml version="1.0"?>
    >
    > <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
    > Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" >
    >
    > <web-app>
    > <servlet>
    > <servlet-name>HelloServlet</servlet-name>
    > <servlet-class>hello.HelloServlet</servlet-class>
    > </servlet>
    > <servlet-mapping>
    > <servlet-name>HelloServlet</servlet-name>
    > <url-pattern>/HelloServlet/*</url-pattern>



    Try THIS
    <url-pattern>/HelloServlet</url-pattern>


    > </servlet-mapping>
    > <welcome-file-list>
    > <welcome-file>welcome.html</welcome-file>
    > </welcome-file-list>
    > </web-app>
    >
    > I place the hello.war in the jboss/server/default/deploy directory.
    > JBoss starts up fine saying that the war file has been deployed.
    > In my browser, I typehttp://localhost:8080/hello/welcome.html
    > This works fine.
    >
    > However when I dohttp://localhost:8080/hello/HelloServlet
    >
    > I get
    > "javax.servlet.ServletException: Wrapper cannot find servlet class
    > hello.HelloServlet or a class it depends on"
    > and so on.
    > I have been following the SAMS Teach yourself EJB book.
    >
    > Please help. Thanks, DG
    vishist, Apr 3, 2007
    #2
    1. Advertising

  3. Danno Guest

    On Apr 2, 9:49 pm, wrote:
    > Hello,
    > This is a newbie question. Any help would be MUCH appreciated.
    >
    > I am using JBoss. My servlet, HelloServlet, prints a simple Hello
    > statement. I create a hello.war file with files
    >
    > welcome.html
    > META-INF/Manifest.mf
    > WEB-INF/web.xml
    > WEB-INF/classes/HelloServlet.class
    >


    also your war file should look like this, note the hello directory...

    welcome.html
    META-INF/Manifest.mf
    WEB-INF/web.xml
    WEB-INF/classes/hello/HelloServlet.class
    Danno, Apr 3, 2007
    #3
  4. Guest

    On Apr 3, 9:59 am, "Danno" <> wrote:
    > On Apr 2, 9:49 pm, wrote:
    >
    > > Hello,
    > > This is a newbie question. Any help would be MUCH appreciated.

    >
    > > I am using JBoss. My servlet, HelloServlet, prints a simple Hello
    > > statement. I create a hello.war file with files

    >
    > > welcome.html
    > > META-INF/Manifest.mf
    > > WEB-INF/web.xml
    > > WEB-INF/classes/HelloServlet.class

    >
    > also your war file should look like this, note the hello directory...
    >
    > welcome.html
    > META-INF/Manifest.mf
    > WEB-INF/web.xml
    > WEB-INF/classes/hello/HelloServlet.class


    Thanks , all of you , a lot.

    I tried it.. the error I get now is
    The requested service (Servlet HelloServlet is currently unavailable)
    is not currently available.

    any help?
    , Apr 3, 2007
    #4
  5. Guest

    On Apr 3, 11:00 am, wrote:
    > On Apr 3, 9:59 am, "Danno" <> wrote:
    >
    >
    >
    >
    >
    > > On Apr 2, 9:49 pm, wrote:

    >
    > > > Hello,
    > > > This is a newbie question. Any help would be MUCH appreciated.

    >
    > > > I am using JBoss. My servlet, HelloServlet, prints a simple Hello
    > > > statement. I create a hello.war file with files

    >
    > > > welcome.html
    > > > META-INF/Manifest.mf
    > > > WEB-INF/web.xml
    > > > WEB-INF/classes/HelloServlet.class

    >
    > > also your war file should look like this, note the hello directory...

    >
    > > welcome.html
    > > META-INF/Manifest.mf
    > > WEB-INF/web.xml
    > > WEB-INF/classes/hello/HelloServlet.class

    >
    > Thanks , all of you , a lot.
    >
    > I tried it.. the error I get now is
    > The requested service (Servlet HelloServlet is currently unavailable)
    > is not currently available.
    >
    > any help?- Hide quoted text -
    >
    > - Show quoted text -



    OK, I have tried some different things. I put HelloServlet.jar in the
    package hello so it is now hello.HelloServlet. I do
    http://localhost:8080/servlets/hello/HelloServlet
    and get
    The requested resource (/hello/HelloServlet) is not available.

    Next, I use
    jboss/catalina/webapps/servlets/helloapp and place
    helloapp/META-INF
    helloapp/WEB-INF/web.xml
    helloapp/WEB-INF/classes/hello/HelloServlet.class
    and do
    http://localhost:8080/servlets/hello/HelloServlet
    Now I get

    No Context configured to process this request
    server encountered an internal error (No Context configured to process
    this request) that prevented it from fulfilling this request.

    Oh dear, what Can I do?
    , Apr 3, 2007
    #5
  6. Lew Guest

    wrote:
    > OK, I have tried some different things. I put HelloServlet.jar in the
    > package hello so it is now hello.HelloServlet. I do
    > http://localhost:8080/servlets/hello/HelloServlet
    > and get
    > The requested resource (/hello/HelloServlet) is not available.
    >
    > Next, I use
    > jboss/catalina/webapps/servlets/helloapp and place
    > helloapp/META-INF
    > helloapp/WEB-INF/web.xml
    > helloapp/WEB-INF/classes/hello/HelloServlet.class


    Is your app called "helloapp" or "hello"?

    Paths in the WAR should be relative, that is, the app directory should not be
    there.

    I'm going to assume "helloapp.war" deployed to Tomcat, thus creating a
    "webapps/helloapp/" directory.

    > and do
    > http://localhost:8080/servlets/hello/HelloServlet
    > Now I get
    >
    > No Context configured to process this request
    > server encountered an internal error (No Context configured to process
    > this request) that prevented it from fulfilling this request.
    >
    > Oh dear, what Can I do?


    You need to deploy "helloapp.war" to Tomcat's "webapps/" directory and let
    Tomcat create the "helloapp/" directory there.

    Inside Tomcat's "webapps/helloapp/WEB-INF/" directory there is a file
    web.xml:
    --------
    <web-app>
    <servlet>
    <servlet-name>HelloServlet</servlet-name>
    <servlet-class>hello.HelloServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloServlet</servlet-name>
    <url-pattern>/HelloServlet</url-pattern>
    </servlet-mapping>
    </web-app>

    Notice, no "/*" at the end of the servlet-mapping url-pattern.

    location of servlet class within "webapps/helloapp/":
    --------
    WEB-INF/classes/hello/HelloServlet.class


    invocation from the browser:

    http://localhost:8080/helloapp/HelloServlet

    Tomcat's web page has some good stuff about this.
    <http://tomcat.apache.org/tomcat-5.5-doc/appdev/deployment.html>

    Their docs talk about using their Deployer, which I never use.

    The Sun Java EE tutorial is also good. Try
    <http://java.sun.com/javaee/5/docs/tutorial/doc/WebApp4.html#wp189052>

    --
    Lew
    Lew, Apr 3, 2007
    #6
    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.

Share This Page