My WAR is deploying fine in TomEE under the correct context root "/myApp" so that I can go to http://localhost:8080/myApp
I have some static files under: /myApp/WEB-INF/files
From looking at the exploded WAR the files are definitely there. My problem is when in code I have written servletContext.getResource("/WEB-INF/files/MyFile.json")
I am getting an error that the file is not found because it appears the actual path in the logs is:
/localhost/myApp/WEB-INF/files/MyFile.json
This code was actually working when I had the app in a regular tomcat server, in Google App Engine and even in WebSphere 7. In TomEE I am NOT deploying the app under webapps but under wtpwebapps. I've done searches for context configuration but most of those deal with making the app have a context root of "" (making it the root app).
I can write some code to remove the "/localhost" part of the URL but WHY is it being placed in there?
That looks like one of Tomcat's internal jndi URLs which takes the form:
jndi:/hostname/contextPath/pathInWebApp
It looks like you have found a TomEE bug.