Giter Club home page Giter Club logo

Comments (5)

md5 avatar md5 commented on May 27, 2024

You'll want to mount your exploded WAR directory as a subdirectory of webapps, not at webapps itself. If you want the app to show up at the root context (i.e. /), then you'll need to mount it at webapps/root. Otherwise, you'll mount it at whatever your context path is (e.g. webapps/hello-world for /hello-world).

from docker-jetty.

DazWilkin avatar DazWilkin commented on May 27, 2024

Thank you.

The exploded WAR was hello-world-0.1-SNAPSHOT. I renamed it to helloworld.

I tried:

docker run -d -p 8080:8080 -v /.../target/helloworld:/var/lb/jetty/webapps/root jetty:9

and

http://myhost:8080/
http://myhost:8080/hello/

But same-same.

from docker-jetty.

md5 avatar md5 commented on May 27, 2024

Can you make sure you're using the latest version of the jetty:9 image? It's possible you're using one from before the JETTY_BASE changes. If so, you'd see a warning like this in docker logs:

2015-04-18 18:48:09.240:WARN:oejs.HomeBaseWarning:main: This instance of Jetty is not running from a separate {jetty.base} directory, this is not recommended. See documentation at http://www.eclipse.org/jetty/documentation/current/startup.html
2015-04-18 18:48:09.757:INFO:oejs.Server:main: jetty-9.2.9.v20150224
2015-04-18 18:48:09.826:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/usr/local/jetty/webapps/] at interval 1

I was just able to to hit a sample WAR at both / and /sample like this:

$ curl -fsSLO https://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/sample.war
$ unzip -d sample sample.war
Archive:  sample.war
   creating: sample/META-INF/
  inflating: sample/META-INF/MANIFEST.MF  
   creating: sample/WEB-INF/
   creating: sample/WEB-INF/classes/
   creating: sample/WEB-INF/classes/mypackage/
   creating: sample/WEB-INF/lib/
   creating: sample/images/
  inflating: sample/WEB-INF/classes/mypackage/Hello.class  
  inflating: sample/WEB-INF/web.xml  
  inflating: sample/hello.jsp       
  inflating: sample/images/tomcat.gif  
  inflating: sample/index.html    
$ docker run -d -p 8080:8080 -v $(pwd)/sample:/var/lib/jetty/webapps/sample \
   -v $(pwd)/sample:/var/lib/jetty/webapps/root --name jetty jetty:9
2bafba59cc22508f4eae8111e1394574d9d95d8dafd2d4eddca8e80413ee9491 

This is what I see in the Docker logs after running that command:

$ docker logs jetty
Running Jetty: 
2015-04-18 18:49:41.743:INFO::main: Logging initialized @431ms
2015-04-18 18:49:42.006:INFO:oejs.SetUIDListener:main: Setting umask=02
2015-04-18 18:49:42.020:INFO:oejs.SetUIDListener:main: Opened ServerConnector@6387a6dd{HTTP/1.1}{0.0.0.0:8080}
2015-04-18 18:49:42.020:INFO:oejs.SetUIDListener:main: Setting GID=999
2015-04-18 18:49:42.021:INFO:oejs.SetUIDListener:main: Setting UID=999
2015-04-18 18:49:42.027:INFO:oejs.Server:main: jetty-9.2.10.v20150310
2015-04-18 18:49:42.045:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/var/lib/jetty/webapps/] at interval 1
2015-04-18 18:49:42.603:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@55716fcd{/sample,file:/var/lib/jetty/webapps/sample/,AVAILABLE}{/sample}
2015-04-18 18:49:42.817:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@44eeef95{/,file:/var/lib/jetty/webapps/root/,AVAILABLE}{/root}
2015-04-18 18:49:42.834:INFO:oejs.ServerConnector:main: Started ServerConnector@6387a6dd{HTTP/1.1}{0.0.0.0:8080}
2015-04-18 18:49:42.835:INFO:oejs.Server:main: Started @1523ms

Notice in particular the Deployment monitor [file:/var/lib/jetty/webapps/] part.

from docker-jetty.

DazWilkin avatar DazWilkin commented on May 27, 2024

I really appreciate your help with this.

This works perfectly for me. I'm going to review and see what I'm doing wrong with my helloworld app.

Thank you.

from docker-jetty.

md5 avatar md5 commented on May 27, 2024

👍

If you end up finding anything wrong with the jetty image, feel free to reopen this issue.

from docker-jetty.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.