This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Other Java Products and Servers and the fly likes A problem running a WAR using Jetty Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "A problem running a WAR using Jetty" Watch "A problem running a WAR using Jetty" New topic
Author

A problem running a WAR using Jetty

Jacob Biran
Greenhorn

Joined: Jun 22, 2010
Posts: 1
When using Jetty embedded in project (not with start.jar, but with its Server object), you can add WAR support to a certain WAR file, using the setWar() method of the WebAppContext object. But the WAR will be shown as a static file you can download (kind of a zip file) in a list of the its folder contents. Unless it has the same ProtectionDomain as the project (i.e. it's somewhere inside the /src folder), then it will be executed and show its contents (index.jsp). It is because Jetty Server found out it is safe to execute the WAR since its in the same ProtectionDomain.
My problem occurred when trying to do the same when running the whole project from a Runnable JAR. Then, my WAR file happened to be located in jar:file:/.../myProj.jar!/.../myWar.war, instead of file:/.../myProj/bin/.../myWar.war. Nothing to be afraid of in terms of ClassLoader, but Jetty server founds it out as different ProtectionDomains, leading to a static display of the WAR file to download, instead of displaying its index.jsp and other content.

How can I tell Jetty to let go and execute the WAR, even though it's inside a JAR?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A problem running a WAR using Jetty
 
Similar Threads
Webspere 345 exam questions
download extension mechanism not working for WAR file in WebLogic 7.0
Custom Policy Setting, Jboss, EAR deployment issue
log4j with Applet
Maven: What's the big deal?