I have the following code:
Server server = new Server(9090); final URL warUrl = Main.class.getClassLoader().getResource("com/domain/webapps/app"); final String warUrlString = warUrl.toExternalForm(); WebAppContext wac = new WebAppContext(warUrlString, "/app"); server.setHandler(wac);
I have a Main class in the com.domain package.
jsp and html are in the package com.domain.webapps.app .
When launched inside Netbeans (or java -cp <classpath> com.domain.Main on an exploded bank), the application works fine.
If I run jar ( java -jar app.jar ), the contents of com.domain.webapps.app will be extracted to /tmp/Jetty_something/webapp/ , so the full path is /tmp/Jetty_something/webapp/com/domain/webapps/app/
But when I make a request for http://localhost:9090/app/file.jsp , Jetty tries to get the file from /tmp/Jetty_something/webapp/file.jsp (wrong place :-()
What can I do where?
Jetty Version 6.1.26
java jetty embedded-jetty
paf.goncalves
source share