0

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?

cain4355
  • 1,094
  • 1
  • 10
  • 22

1 Answers1

0

"Could not find resource for relative : /index.html" indicates your app is trying to dig up index.html as a RESTful resource and not as a static file.

Without seeing your web.xml, I'm guessing you have a <servlet-mapping> entry that's handling all URL patterns; something like this:

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

To address this issue, this SO looks helpful, which essentially suggests adding an additional token to the path to your resources, such as:

<url-pattern>/service/*</url-pattern>

This means you'll have to access your Query resource as http://localhost:8080/Test/service/Query?key=Hello%20World.

Community
  • 1
  • 1
Ted S.
  • 91
  • 8