Jetty Standalone Setup Help

I am considering using itmill for our project. I want to create a setup for jetty standalone (not the standard java web setup) with itmill. Anybody could help?

What I really meant was Jetty run inside an application in embedded mode. Any help?

IT Mill Toolkit distribution comes with integrated Jetty, so I would say somebody definitely can help you. :slight_smile:

First take a look at:

Also, some time ago I made experiments with “desktop web application” packaging as a stand-alone application ( executable jar and windows exe). Back then I was
using the Winstone servlet container

Servlet packaging and classloading are the biggest challenges, but IT Mill Toolkit should work as in any web application.

  1. add this class to your project, e.g. as

import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.webapp.WebAppContext;

 * Start IT Mill Toolkit example application as standard java program. Uses
 * Jetty Servlet Container which is easy to run / debug with e.g. Eclipse IDE.
public class StartServletContainer {

	public static int PORT = 8888;

	public static void main(String[] args) {

		try {
			final Server server = new Server();

			final Connector connector = new SelectChannelConnector();
			server.setConnectors(new Connector[] { connector });

			final WebAppContext webappcontext = new WebAppContext();

			System.out.println("Jetty started, please go to http://localhost:"
					+ PORT + "/");
		} catch (final Exception e) {


  1. add these three classes to your classpath

  1. Add file WebContent/WEB-INF/web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi=""
	id="WebApp_ID" version="2.5">
	<display-name>IT Mill Toolkit example application</display-name>


	<!-- Toolkit example application -->

	<!-- Let any Toolkit servlet to handle static files too (/ITMILL/* resources) -->
	<!-- In production environment we can let e.g. Apache handle these more efficiently -->

	<!-- redirects us to example application -->

  1. Then execute as standard java executable, e.g. from Eclipse “Run as Java application” or “Debug as Java application”

  2. Surf to http://localhost:8888

Thousands Thanks. I will try that pronto. Thank you.

Here’s latest launcher file that should work out of the box with any Eclipse Galileo distributions (Java, Classic or JEE). No additional plug-ins, JARs or Servlet Container downloads and installations are required. Eclipse already contains Jetty. Hot code replace is almost immediate and works 100% reliably.

For other IDE’s except Eclipse, add download and add Jetty JARs to your classpath.

Important: remove all other conflicting Servlet Containers from your classpath, e.g. Apache Tomcat v6.0.

package com.example.launch;

import org.mortbay.jetty.Server;
import org.mortbay.jetty.webapp.WebAppContext;

public class Launcher {

	private static String contextPath = "/";
	private static String resourceBase = "WebContent";
	private static int httpPort = 8888;

	public static void main(String[] args) throws Exception {
		Server server = new Server(httpPort);
		WebAppContext webapp = new WebAppContext();
		System.out.println("Started Jetty " + Server.getVersion()
				+ ", go to http://localhost:" + httpPort + contextPath);


Hi there,

i have tried to use Jani Laakso Launcher-Class to start a VaadinApplication with Eclipse and Jetty. The start works, i can go to the main site and i can see my label. But when I change the labeltext in eclipse, and start the application with “?restartApplication” there is no change to see :frowning:

Can anyone help me?


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="" xmlns="" xmlns:web="" xsi:schemaLocation="" id="WebApp_ID" version="2.5">
  	Vaadin production mode</description>
  	<servlet-name>Jettytest Application</servlet-name>
  		Vaadin application class to start</description>
  	<servlet-name>Jettytest Application</servlet-name>

The Application

package com.example.jettytest;

import com.vaadin.Application;
import com.vaadin.ui.Label;
import com.vaadin.ui.Window;

public class JettytestApplication extends Application {
	public void init() {
		Window mainWindow = new Window("Jettytest Application");
		Label label = new Label("Hello Vaadin user12312312312");


When I start the Launcher-Class i see following message:

And here you can find my sturcture of the eclipse-project:

Any idea?


Quick shot in the dark from the been-there-done-that department: did you by any chance start the server with “run” instead of “debug”?

Best Regards,

Oh, that’s awkward :frowning: I’m sorry, Marc was right, i started it in normal mode instead of the debug mode… Thank’s a lot!