For those interested, I was able to get this to work by configuring Launch4J to not wrap the Jar but to create a separate EXE launcher. This keeps the archive structure intact.
On Fri, Oct 3, 2014 at 8:03 PM, William Ferguson < [email protected]> wrote: > Thanks Jan,that was a good lead. But it looks like I am hosed. > > Launch4J has changed the structure of the file such that while jar and > WinZip will happily list the entries and Winzip will extract the contents, > jar extracts nothing and JarInputStream reports zero entries. The actual > byte structure is not equivalent. > > William > > On Fri, Oct 3, 2014 at 11:11 AM, Jan Bartel <[email protected]> wrote: > >> William, >> >> I suggest you turn on DEBUG logging for the >> o.e.j.webapp.WebInfConfiguration class - it is the one responsible for >> unpacking a war. The debug should help you work out the url and >> location of the war that is to be extracted. Note that if the .war is >> packed again inside a .exe I wouldn't expect Jetty to be able to >> extract it - we don't deal with that many layers of onion skin: the >> webapp must be either a directory or a packed war. >> >> regards >> Jan >> >> On 3 October 2014 10:15, William Ferguson >> <[email protected]> wrote: >> > Even though I am starting an embedded Jetty instance with: >> > >> > final Server server = new Server(port); >> > server.setHandler(webApp); >> > final WebAppContext webApp = new WebAppContext(); >> > webApp.setContextPath("/"); >> > webApp.setWelcomeFiles(new String[]{"index.html"}); >> > webApp.setWar(exeFile.getAbsolutePath()); >> > >> > Is it possible that the WebAppProvider >> > ( >> http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/deploy/providers/WebAppProvider.html >> ) >> > is being invoked and is excluding the WebApp content because the >> launching >> > file doesn't end in .war? >> > >> > William >> > >> > >> > On Fri, Oct 3, 2014 at 9:38 AM, William Ferguson >> > <[email protected]> wrote: >> >> >> >> @Michael Launch4J doesn't have anything to do with Jetty's webapp >> content >> >> extraction process. So asking these questions of Launch4J would be >> >> inappropriate. >> >> Clearly some context that is being expected within Jetty is not being >> met >> >> when bundled as an EXE. You can only answer these questions from >> within a >> >> Jetty perspective. >> >> ------ >> >> So my question is, what is responsible within Jetty for extracting the >> >> webapp content? >> >> What might be causing it to not extract from an application.exe >> archive vs >> >> an application.war archive? >> >> What can be done to make it extract the content when repackaged as EXE? >> >> ------ >> >> >> >> I'm happy to dive into the Jetty code, but I need a jumping off point. >> >> >> >> William >> >> >> >> On Fri, Oct 3, 2014 at 9:32 AM, Michael Dykman <[email protected]> >> wrote: >> >>> >> >>> The problem appears to be with launch4j, not Java or Jetty. This is >> the >> >>> wrong forum to ask. >> >>> >> >>> On 2 Oct 2014 19:23, "William Ferguson" < >> [email protected]> >> >>> wrote: >> >>>> >> >>>> The EXE has full permissions. >> >>>> >> >>>> There is no extra SecutiryManager being applied by the launcher. >> >>>> >> >>>> I wasn't specifying an explicit WebAppContext#tempDirectory so it was >> >>>> already using java.io.tmpdir >> >>>> >> >>>> Now this seems strange .. >> >>>> When I specify an explicit WebAppContext#tempDirectory (for both the >> EXE >> >>>> and WAR versions), the explicit folder is never created. And if it >> existed >> >>>> beforehand it is deleted on server start. And there is no folder >> being >> >>>> created in java.io.tmpdir. In any case for the WAR Jetty serves >> normally, >> >>>> for the EXE it now throws a 503. >> >>>> >> >>>> William >> >>>> >> >>>> On Fri, Oct 3, 2014 at 9:01 AM, Joakim Erdfelt <[email protected]> >> >>>> wrote: >> >>>>> >> >>>>> Most EXE processes are merely launchers for java and your app. >> >>>>> Nothing really changes as far as the jars / classes etc. >> >>>>> They are usually left, in-tact. >> >>>>> >> >>>>> Since this is being launched on windows, via an EXE, I would start >> to >> >>>>> look at permissions that your EXE has. >> >>>>> It might not have the rights to do what you think it should be able >> to >> >>>>> do. (look at the rights of the application/exe on windows for this) >> >>>>> >> >>>>> Also look into any sort of java SecurityManager that is applied to >> your >> >>>>> running application. (some launchers apply custom SecurityManager >> >>>>> configurations) >> >>>>> >> >>>>> Out of curiosity, are there files in your java.io.tmpdir instead? >> >>>>> >> >>>>> >> >>>>> -- >> >>>>> Joakim Erdfelt <[email protected]> >> >>>>> webtide.com - intalio.com/jetty >> >>>>> Expert advice, services and support from from the Jetty & CometD >> >>>>> experts >> >>>>> eclipse.org/jetty - cometd.org >> >>>>> >> >>>>> On Thu, Oct 2, 2014 at 3:37 PM, William Ferguson >> >>>>> <[email protected]> wrote: >> >>>>>> >> >>>>>> I have a webapp that is packaged as a WAR but for which I have a >> main >> >>>>>> application class that creates an embedded Jetty instance to serve >> the WAR. >> >>>>>> All works well. >> >>>>>> When the app starts Jetty extracts the WebApp content into the >> >>>>>> WebAppContext#tempDirectory and Jetty serves all resources. >> >>>>>> >> >>>>>> But I am trying to package the WAR as an EXE using launch4J and am >> >>>>>> running into a problem. Launch4J creates the EXE, the EXE starts >> and my main >> >>>>>> class starts the Jetty server. But while the >> WebAppContext#tempDirectory is >> >>>>>> being correctly set, the contents of the WebApp are not being >> extracted into >> >>>>>> it. >> >>>>>> >> >>>>>> Jetty does create the tempDirectory with a webapp child folder, but >> >>>>>> that child folder is empty. This means that Jetty returns 404 for >> >>>>>> everything. >> >>>>>> >> >>>>>> NB the EXE that is generated by Launch4J is a valid archive and >> can be >> >>>>>> opened as such by WinZip etc. >> >>>>>> >> >>>>>> So my question is, what is responsible within Jetty for extracting >> the >> >>>>>> webapp content? >> >>>>>> What might be causing it to not extract from an application.exe >> >>>>>> archive vs an application.war archive? >> >>>>>> What can be done to make it extract the content when repackaged as >> >>>>>> EXE? >> >>>>>> >> >>>>>> This is on Jetty 9.1.1.v20140108 >> >>>>>> >> >>>>>> William >> >>>>>> >> >>>>>> _______________________________________________ >> >>>>>> jetty-users mailing list >> >>>>>> [email protected] >> >>>>>> To change your delivery options, retrieve your password, or >> >>>>>> unsubscribe from this list, visit >> >>>>>> https://dev.eclipse.org/mailman/listinfo/jetty-users >> >>>>> >> >>>>> >> >>>>> >> >>>>> _______________________________________________ >> >>>>> jetty-users mailing list >> >>>>> [email protected] >> >>>>> To change your delivery options, retrieve your password, or >> unsubscribe >> >>>>> from this list, visit >> >>>>> https://dev.eclipse.org/mailman/listinfo/jetty-users >> >>>> >> >>>> >> >>>> >> >>>> _______________________________________________ >> >>>> jetty-users mailing list >> >>>> [email protected] >> >>>> To change your delivery options, retrieve your password, or >> unsubscribe >> >>>> from this list, visit >> >>>> https://dev.eclipse.org/mailman/listinfo/jetty-users >> >>> >> >>> >> >>> _______________________________________________ >> >>> jetty-users mailing list >> >>> [email protected] >> >>> To change your delivery options, retrieve your password, or >> unsubscribe >> >>> from this list, visit >> >>> https://dev.eclipse.org/mailman/listinfo/jetty-users >> >> >> >> >> > >> > >> > _______________________________________________ >> > jetty-users mailing list >> > [email protected] >> > To change your delivery options, retrieve your password, or unsubscribe >> from >> > this list, visit >> > https://dev.eclipse.org/mailman/listinfo/jetty-users >> >> >> >> -- >> Jan Bartel <[email protected]> >> www.webtide.com >> 'Expert Jetty/CometD developer,production,operations advice' >> _______________________________________________ >> jetty-users mailing list >> [email protected] >> To change your delivery options, retrieve your password, or unsubscribe >> from this list, visit >> https://dev.eclipse.org/mailman/listinfo/jetty-users >> > >
_______________________________________________ jetty-users mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jetty-users
