[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-users] creating runnable wars with maven
|
Hi,
unfortunately I am not familiar with this ProtectionDomain thing (and,
admittedly, currently a little bit lazy). On the other hand I have some
experience with deployments but cannot clearly figure out what you
exactly want to deploy.
Could you please give some details?
Right now, for me it seems like you want to deploy a JAR, which has
itself a nested WAR. The war spawns a Jetty server to which the
embedded WAR shall be deployed, correct? Or was it all about just
having the WAR in the first place and starting Jetty via a class file
under unreachable WEB-INF/classes? If the latter, it might then work if
you just put the Jetty starter stub to its usual JAR location within
the WAR, i.e. without WEB-INF/classes.
But, obviously, I am a little bit confused right now... clarification
is needed :)
Regards,
Andreas
Am Fr 01 Mär 2013 04:20:03 CET schrieb S Ahmed:
Curious, is it possible to run an embedded jetty with an exploded war
file? (This will make uploaded a specific jar to production faster
since the file payload is less than having to push the entire .war file)
On Thu, Feb 28, 2013 at 7:22 AM, S Ahmed <sahmed1020@xxxxxxxxx
<mailto:sahmed1020@xxxxxxxxx>> wrote:
According to this article:
http://jowisoftware.de/blog/archives/26-Creating-runnable-wars-with-Maven-and-Jetty.html
When trying to run:
java -jar myproject.war
I get the main-class error:
Exception in thread "main" java.lang.NoClassDefFoundError:
com/myprjoect/path/to/main/ClassName
According to that article the issue is: "The problem is easy to
understand: when starting Java with -jar, it expects a "normal"
file structure. So if the Main-Class is "de.jowisoftware.Main",
Java looks for de/jowisoftware/Main.class. The classloader does
not understand the concept, that, in war files all class files are
in WEB-INF/classes. If jetty is included in the war file, it is
included as a jar file, so the classloader has to support nested
archives. The default one doesn't. Thankfully, there are solutions."
What options do I have, is it basically how the author of the blog
posts states?
Or is the alternative ways to embedding jetty and then launching it?
I have this:
ProtectionDomain protectionDomain =
HttpServer.class.getProtectionDomain();
String warFile =
protectionDomain.getCodeSource().getLocation().toExternalForm();
String currentDir = new
File(protectionDomain.getCodeSource().getLocation().getPath()).getParent();
WebAppContext webAppContext = new WebAppContext(warFile,
contextPath);
resetTempDirectory(webAppContext, currentDir);
webAppContext.setParentLoaderPriority(true);
server.setHandler(webAppContext);
server.start();
server.join();
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users