1 Reply Latest reply on Dec 18, 2015 4:04 PM by msegreti4355

    Access HTML within WAR file

    msegreti4355

      I cannot access my index.html from my .war file. I placed the index.html in the root war file path. This is also where the META-INF and WEB-INF folders are located. When I try and access it from my url http://localhost:8080/Test/index.html i get

      JBWEB000065: HTTP Status 404 - Could not find resource for relative : /index.html of full path: http://localhost:8080/Test/index.html

       

      On my server.log I see that the server started successfully without any errors. Also, when I try and access the page I do not get any stack traces on the server.log. I also have a web service built within the war file and when I test the RESTful service (http://localhost:8080/Test/Query?key=Hello%20World) I get a successful response.

       

      What am I doing wrong that I cannot access the web page?

        • 1. Re: Access HTML within WAR file
          msegreti4355

          In my web.xml I had:

           

          <servlet-mapping>
            <servlet-name>RESTful</servlet-name>
            <url-pattern>/*</url-pattern>
          </servlet-mapping>

           

          This caused all urls to point to be assumed as a RESTful service. To fix I did:

           

          <servlet-mapping>
            <servlet-name>RESTful</servlet-name>
            <url-pattern>/Test/*</url-pattern>
          </servlet-mapping>

           

          This assumes anything with "Test" in the path is a service call instead of a resource lookup.