One-jar with embeded jetty

8 views
Skip to first unread message

Hrishikesh Joshi

unread,
Nov 4, 2015, 10:21:55 AM11/4/15
to onejar
Hi,

I am trying to use one-jar plugin to create executable jar with embeded jetty. I am reffering my webapp resources as 

String resLocation = MainClass.class.getResource("/webapp").toString();
webAppContext.setResourceBase(resLocation);


But with one jar I am not able to find this resource since there is no /webapp now. Its under the main jar. Any clue how to get it working?

Simon Tuffs

unread,
Nov 4, 2015, 10:28:25 AM11/4/15
to onejar
Hi Hrishikesh: 

one-jar and jetty-embedded are complimentary approaches: both manage classloading for a group of jars within an application. one-jar is not a web-server, jetty-embedded is. I believe what you are trying to do is best achieved using executable jetty WAR files, not one-jar, because the classloaders in one-jar and jetty are unaware of each other.  Google "executable jetty" or check out this link: http://eclipsesource.com/blogs/2009/10/02/executable-wars-with-jetty/   or this http://stackoverflow.com/questions/2458440/executable-war-file-that-starts-jetty-without-maven

Good luck.

Simon.
Reply all
Reply to author
Forward
0 new messages