3 Replies Latest reply on Jan 29, 2004 3:54 PM by ahaaf

    Cannot Run Servlets

    ahaaf Newbie

       

      "ahaaf" wrote:
      I receive a 404 error when trying to run my servlets in JBoss 3.2.2. It says the requested resource is not available. Here is the output from the console after copying the ear to server/default/deploy:

      :/jboss-3.2.2/server/default/tmp/deploy/tmp20547webexample.ear-contents/webexamp
      le.war/
      14:44:39,710 INFO [Engine] ContextConfig[/andy]: Added certificates -> request
      attribute Valve
      14:44:44,938 WARN [EmbeddedTomcatService] Unable to invoke setDelegate on class
      loader:org.jboss.web.tomcat.tc4.WebCtxLoader$ENCLoader@1a0d346
      14:44:44,938 INFO [Engine] StandardManager[/andy]: Seeding random number genera
      tor class java.security.SecureRandom
      14:44:44,948 INFO [Engine] StandardManager[/andy]: Seeding of random number gen
      erator has been completed
      14:44:44,948 INFO [Engine] StandardWrapper[/andy:default]: Loading container se
      rvlet default
      14:44:44,948 INFO [Engine] StandardWrapper[/andy:invoker]: Loading container se
      rvlet invoker
      14:44:45,388 INFO [EARDeployer] Started J2EE application: file:/C:/jboss-3.2.2/
      server/default/deploy/webexample.ear
      14:44:45,388 INFO [MainDeployer] Deployed package: file:/C:/jboss-3.2.2/server/
      default/deploy/webexample.ear
      14:44:45,408 INFO [URLDeploymentScanner] Started jboss.deployment:type=Deployme
      ntScanner,flavor=URL
      14:44:45,508 INFO [MainDeployer] Deployed package: file:/C:/jboss-3.2.2/server/
      default/conf/jboss-service.xml
      14:44:45,508 INFO [Server] JBoss (MX MicroKernel) [3.2.2 (build: CVSTag=JBoss_3
      _2_2 date=200310182216)] Started in 34s:449ms

      Notice the error in setDelegate.

      My web.xml file looks like:

      <?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>SMTPMailer</servlet-name>
      <servlet-class>SMTPMailer</servlet-class>
      </servlet>
      <servlet>
      <servlet-name>SimpleServlet</servlet-name>
      <servlet-class>SimpleServlet</servlet-class>
      </servlet>

      <servlet-mapping>
      <servlet-name>SMTPMailer</servlet-name>
      <url-pattern>/andy</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>SimpleServlet</servlet-name>
      <url-pattern>/andy</url-pattern>
      </servlet-mapping>
      </web-app>

      My application.xml file looks like:

      <?xml version="1.0"?>
      <application>
      <display-name>AndyJBossWeb</display-name>
      <module>
      <web>
      <web-uri>webexample.war</web-uri>
      <context-root>andy</context-root>
      </web>
      </module>
      </application>

      Any help is greatly appreciated.


        • 1. Re: Cannot Run Servlets
          David Newbie

           

          "dlindsay" wrote:
          I am having a similiar problem.

          I jusat upgraded from 3.0.2 to 3.2.3. A servelt I was using to download data is no longer found by Tomcat. I get this message pushed to the browser:

          HTTP Status 404 - /express-web/servlet/Download
          type Status report
          message /express-web/servlet/Download
          description The requested resource (/express-web/servlet/Download) is not available.
          Apache Tomcat/4.1.29

          I know that 3.0.2 used Jetty instead of Tomcat. I'm pretty confident it's related to how WAR archives and web.xml servlet declarations are interpreted differently between the two (since nothing else has changed codewise on my end).

          -David


          • 2. Re: Cannot Run Servlets
            David Newbie

             

            "dlindsay" wrote:
            My problem turned out to be because I was not defining a servlet-mapping section in web.xml. Jetty apparently did not care. Here is my final code:

            <servlet>
            <servlet-name>Download</servlet-name>
            <servlet-class>DownloadServlet</servlet-class>
            <init-param>
            <param-name>dir</param-name>
            <param-value>/usr/local/express/cfg</param-value>
            </init-param>
            </servlet>
            <servlet-mapping>
            <servlet-name>Download</servlet-name>
            <url-pattern>/Download</url-pattern>
            </servlet-mapping>


            • 3. Re: Cannot Run Servlets
              ahaaf Newbie

               

              "ahaaf" wrote:
              I have the same info in my web.xml but still get the error. At least got jsps working so I will focus on those instead. Thanks for your help though.