3 Replies Latest reply on Oct 31, 2004 3:31 AM by Joan Horta Tosas

    HTTP Status 404

    Kjell-Einar Ofstad Newbie

      I'm new to JBoss..., hope someone will guide me!!!

      I have deployed TassieOnline.ear (from myEclipse).
      I has some EJB's (..deploy/TassieOnline.ear/TassieOnlineEJB.war) pluss some servlets (deploy/TassieOnline.ear/TassieOnlineWeb.war).

      The book I'm studying says I can access the servlet via this URL:

      Have also tried
      * http://localhost:8080/TassieOnline/...
      * http://localhost:8080/TassieOnlineWeb/...
      and various combinations with and without .../servlet/ServletName

      The result is always the same, HTTP status 404 (the requested resource is not available).

      What should I do?


        • 1. Re: HTTP Status 404
          Joan Horta  Tosas Novice

          Do you have a jboss-web.xml in your WAR file or application.xml in EAR file? If so, can you provide them, as well as your web.xml file? That could help.

          • 2. Re: HTTP Status 404
            Kjell-Einar Ofstad Newbie

            This is
            <?xml version="1.0" encoding="UTF-8"?>
            <applicationxmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd" >



            Here follows
            <?xml version="1.0" encoding="UTF-8"?>
            <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
            <display-name>Deployment for Tassie Online</display-name>

            Tassie Online Book Store -- Example application




            I should also mention that according to the log-file this application is loaded without any error:
            10:25:51,886 INFO [EARDeployer] Init J2EE application: file:/usr/local/jboss-4.0.0/server/default/deploy/TassieOnline.ear/
            10:25:52,486 INFO [EjbModule] Deploying Search
            10:25:52,585 INFO [EjbModule] Deploying BookDetails
            10:25:52,669 INFO [EjbModule] Deploying Cart
            10:25:53,219 INFO [EJBDeployer] Deployed: file:/usr/local/jboss-4.0.0/server/default/deploy/TassieOnline.ear/TassieOnlineEJB.jar/
            10:25:53,328 INFO [TomcatDeployer] deploy, ctxPath=/TassieOnlineWeb, warUrl=file:/usr/local/jboss-4.0.0/server/default/deploy/TassieOnline.ear/TassieOnlineWeb.war/
            10:25:53,837 INFO [EARDeployer] Started J2EE application: file:/usr/local/jboss-4.0.0/server/default/deploy/TassieOnline.ear/

            Any ideas?

            • 3. Re: HTTP Status 404
              Joan Horta  Tosas Novice

              I think I know the problem you have and the solution to it: you have to define the servlet-mapping element on your web.xml file after the servlet element declaration. It can be something like:


              There are two reasons you have to add this:
              - The first one is that with the servlet element you just declare the servlet for being deployed in the webapp, but with the servlet-mapping you associate an URL to your servlet, so "everyone" can access it.
              - What is said in your book about accessing "anonymous" servlets (that is, servlets without mappings) using the URL "/servlet/ServletClass" is correct, but due to security reasons, almost on every web container (like Tomcat) this behaviour is disabled.
              Well, after that explanation only rests to explain you the URL you have to use to access that servlet. If you use the mapping I wrote, it would be "http://localhost:8080/TassieOnlineWeb/Search". This URL is composed first of your webapp context-root (defined in application.xml) which is TassieOnlineWeb, and then the servlet-mapping name you used in the web.xml file (in the example above, "/Search").
              Hope my explanations helps you in understanding the error you have.