Jetty Runner
Run your webapps using a single jar!
If you're looking for a fast and easy way to run your webapp, without needing to install and administer a Jetty distro, then look no further, the Jetty Runner is here! The idea of the Jetty Runner is extremely simple - run a webapp from the command line using a single jar and as much default configuration as possible:
You can also deploy multiple webapps - either packed or unpacked wars - from the command line. In this example, my.war will be available at http://host:8080/one and the my2 webapp will be available at http://host:8080/two:
You'll notice the --lib argument, which is one way to tell jetty about extra jars you want to put onto the container's classpath. We also give you:
java -jar jetty-runner.jar my.warVoila! Jetty will start on port 8080 and deploy the my.war webapp. Couldn't get much simpler, could it?
You can also deploy multiple webapps - either packed or unpacked wars - from the command line. In this example, my.war will be available at http://host:8080/one and the my2 webapp will be available at http://host:8080/two:
java -jar jetty-runner.jar --path /one my1.war --path /two my2Or, for those webapps that need a little more configuration, you can run them via jetty context config files:
java -jar jetty-runner.jar contexts/my.xmlYou can configure the most common things from the command line, like the port to start on, and whether to generate a request log or not:
java --jar jetty-runner.jar --port 9090 --log my/request/log/goes/here my.warYou can even configure a JDBC JNDI Resource entry right on the command line. Here's an example to define a Postgres DB available in JNDI at java:comp/env/jdbc/mydatasource:
java -jar jetty-runner.jar \The syntax of the --jdbc argument is:
--lib ~/src/tools/derby/ --lib ~/src/tools/atomikos \
--jdbc org.apache.derby.jdbc.EmbeddedXADataSource "databaseName=testdb;createDatabase=create" "jdbc/mydatasource" \
my.war
--jdbc <classname of Driver or XADataSource> <db properties> <jndiname>You'll also have to tell jetty where to find your database driver and Atomikos, which we use to provide a transaction manager and wrap XA and non-XA Resources into a DataSource you can access from your webapp.
You'll notice the --lib argument, which is one way to tell jetty about extra jars you want to put onto the container's classpath. We also give you:
--jar <filename>And as if all that wasn't enough, you can get full configuration control using a jetty.xml configuration file:
--classes <dir>
java -jar jetty-runner.jar --config my/jetty.xml my.warYou can see all your options with:
java -jar jetty-runner.jar --helpOh and I should say that the jetty-runner is part of jetty-7, so check out the distro or download the jar from the jetty codehaus repo.
