Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Spring Boot executable jar with embedded Jetty?

Thx for the input and you have some good points.. :)
But I have been using Spring for 12-13 years and it's a habit that is hard to break. And Spring Boot is an easy way to get a project up and running
quickly, so it's just easy to use to create runnable jar files...
I am also thinking it's better for an application server to serve just one application and then have a number of AS to serve a number of applications
instead of having a number of applications deployed on one AS or is that not the case?

Perhaps I should rethink my way of doing things... (A)


BTJ


On Sat, 26 Mar 2016 11:42:06 -0500
Jesse McConnell <jesse.mcconnell@xxxxxxxxx> wrote:

> Not really, it has never been much of a 'thing' if I am honest...we see
> folks ask about it off and on and then typically they decide to just do
> away with the war itself.
> 
> When it gets down to it the reasons you would bundle everything into a war
> file vs setting up an executable type setup don't really line up that
> well.  A war exists in large part to provide something that you can take
> around to commodity containers and deploy seamlessly (at least in theory).
> When you are looking at embedding why would you want to tangle with all the
> overhead, extra classes, bits and fobs of deployments and classloaders when
> you can streamline all of that away and end up with something clearly
> deterministic in code, easily embeddable into test cases, etc.  You can
> just easily mount the servlets and apply all the same filters and normal
> webapp tools directly in code and do away with so much...
> 
> FWIW we wrote a war runner ages ago called jetty-runner which quite a few
> folks still use today for executing war files.
> 
> https://www.eclipse.org/jetty/documentation/current/runner.html
> 
> It follows more of the traditional war file usage only outside of the
> traditional distribution letting you fire up a war from the command line.
> 
> cheers,
> Jesse
> 
> --
> jesse mcconnell
> jesse.mcconnell@xxxxxxxxx
> 
> On Sat, Mar 26, 2016 at 10:42 AM, Bjørn T Johansen <btj@xxxxxxxxxx> wrote:
> 
> > Thx..
> >
> > But it looks to me that Jetty does not support the executable jar format
> > when running a webapplication or am I missing some configuration somewhere?
> > Also, I just created a quick Spring Boot REST project that uses embedded
> > Jetty and executable jar and that works just fine. But then again, there is
> > no web content resources needed...
> > (I guess REST projects is more used by Spring Boot than full web
> > applications...)
> >
> >
> > BTJ
> >
> > On Sat, 26 Mar 2016 09:13:42 -0500
> > Jesse McConnell <jesse.mcconnell@xxxxxxxxx> wrote:
> >
> > > Most folks I know using it have it just work so I am not sure what the
> > > problem is in your situation, if we get the chance we'll take a look
> > > through and see if we can help the spring-boot guys make their jetty
> > usage
> > > a bit more bulletproof.
> > >
> > > cheers,
> > > Jesse
> > >
> > > --
> > > jesse mcconnell
> > > jesse.mcconnell@xxxxxxxxx
> > >
> > > On Sat, Mar 26, 2016 at 5:59 AM, Bjørn T Johansen <btj@xxxxxxxxxx>
> > wrote:
> > >
> > > > Not sure how this executable jar file works but it's very practically
> > when
> > > > deploying a web app, also when thinking about moving to microservices
> > > > arhitecture..
> > > >
> > > > I see the following when I start the application:
> > > >
> > > > Started o.s.b.c.e.j.JettyEmbeddedWebAppContext@24386839
> > > > {/,file:/tmp/jetty-docbase.6160239938147030633.8080/,AVAILABLE}
> > > >
> > > > Where does Jetty find this path? Does it extract the jar file to this
> > > > location and then run it? Seems like it does but
> > > > the directory /tmp/jetty-docbase.6160239938147030633.8080 is empty so
> > no
> > > > wonder why it doesn't find any web content..
> > > >
> > > > Also not sure what you mean by double nested, since the resources is
> > not
> > > > inside a jar file but at the root of the main jar file? You can read
> > about
> > > > the executable jar format here:
> > > >
> > https://docs.spring.io/spring-boot/docs/current/reference/html/executable-jar.html
> > > > I also tried to unzip the jar file and just run it using "java
> > > > org.springframework.boot.loader.JarLauncher" but Jetty still points to
> > a
> > > > directory
> > > > under /tmp that is empty...
> > > >
> > > > I was hoping that I could change to Jetty (since tests confirms that
> > > > performance is better on Jetty than Tomcat) but it seems like not many
> > > > people
> > > > actually is using Spring Boot and embedded Jetty instead of Tomcat
> > cause
> > > > there is not much help to find to solve this. Also not sure how much
> > the
> > > > Spring Boot people have actually tested using Jetty in a real web
> > > > application project.... (it doesn't work right out of the box at
> > least....)
> > > >
> > > >
> > > > Regards,
> > > >
> > > > BTJ
> > > >
> > > > On Fri, 25 Mar 2016 15:46:57 -0700
> > > > Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
> > > >
> > > > > That description seems like it would be the old double nested
> > uncompress
> > > > > issue.
> > > > >
> > > > > We rely on Java to handle the
> > > > > "jar:file:/path/to/app.jar!/path/to/internal/resource.txt"
> > decompression
> > > > of
> > > > > content from an archive.
> > > > > However, Java doesn't handle double-nested (or deep nested) archives.
> > > > >
> > > > > Such as ..
> > > > >
> > jar:file:/tmp/app.jar!/lib/resource.jar!/META-INF/resources/content.html
> > > > >
> > > > > Note that there are two "!/" entries in that URI
> > > > >
> > > > > Not sure how Tomcat handles it...
> > > > > I could imaging you'd either have to replace the "jar" protocol
> > handling
> > > > > with something custom...
> > > > > or decompress the content first to a temp directory for it to work
> > (which
> > > > > is how we do it for standard distribution and standard war files)
> > > > >
> > > > >
> > > > > Joakim Erdfelt / joakim@xxxxxxxxxxx
> > > > >
> > > > > On Fri, Mar 25, 2016 at 2:53 PM, Bjørn T Johansen <btj@xxxxxxxxxx>
> > > > wrote:
> > > > >
> > > > > > I am trying to use Jetty instead of Tomcat as my embededded
> > application
> > > > > > server in my Spring Boot projects but I have a problem. (I tought
> > it
> > > > was
> > > > > > working but I as fooled my IntelliJ IDEA, the jar file built by
> > gradle
> > > > > > does not work...)
> > > > > >
> > > > > > Jetty does not see my web root folder. So I get an 404 error when
> > > > trying
> > > > > > to access my html files..
> > > > > > In Tomcat, I have a my web content inside /META-INF/resources/
> > inside
> > > > my
> > > > > > jar file but that does not work when using Jetty. I have alse
> > tried to
> > > > put
> > > > > > my webcontent inside /static/ and /webapp/ but Jetty still does
> > not see
> > > > > > any html files.
> > > > > >
> > > > > > What am I missing?
> > > > > >
> > > > > >
> > > > > > Regards,
> > > > > >
> > > > > > BTJ
> > > > > >
> > > > > > --
> > > > > >
> > > > > >
> > > >
> > -----------------------------------------------------------------------------------------------
> > > > > > Bjørn T Johansen
> > > > > >
> > > > > > btj@xxxxxxxxxx
> > > > > >
> > > > > >
> > > >
> > -----------------------------------------------------------------------------------------------
> > > > > > Someone wrote:
> > > > > > "I understand that if you play a Windows CD backwards you hear
> > strange
> > > > > > Satanic messages"
> > > > > > To which someone replied:
> > > > > > "It's even worse than that; play it forwards and it installs
> > Windows"
> > > > > >
> > > > > >
> > > >


Back to the top