• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

A problem running a WAR using Jetty

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

 
Their achilles heel is the noogie! Give them noogies tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic