Skip to main content
Jump to: navigation, search


Big Problems

Question Mark.png Why won't Jetty Start?

Question Mark.png Why isn't my application/servlet/content served?

Question Mark.png Jetty has locked up?

If your requests are not getting any responses, then a frequent description of the problem is that "jetty locked up". In order to diagnose such problems, it is very important to work out exactly what has locked up.

You can test if the JVM has locked up completely by trying to use a tool like jconsole or jvisualvm to attach to the process. If you cannot attach to the process, the it is likely something has gone wrong with the JVM and/or operating system rather than Jetty itself.

If you can attach to the JVM with jconsole and/or jvisualvm, then look to see how many threads are allocated and what task they are doing. A frequent cause of such "lockups" is a slow database so that all the threads in the thread pool end up waiting for a JDBC connection from the connection pool.

You can test if Jetty is completely locked up by trying some simple requests and seeing if they are get a response. Hitting or some other image directly is often a good way to see if jetty is still running. If it is, then try some simple requests within the application that will use minimal features (no authentication, no database etc.) and see if any of those requests work.

Finally telnet can be used as a fake HTTP client to see if connections are being accepted. If you telnet to the port (eg 80 or 8080) and you see a "Connected to" message, then Jetty is still accepting connections. Then try typing a request like "OPTION * HTTP/1.0" and hit Enter twice to see if you get a HTTP response. eg

   # telnet 80
   Connected to
   Escape character is '^]'.
   OPTION * HTTP/1.0
   HTTP/1.1 503 Service Unavailable
   Cache-Control: must-revalidate,no-cache,no-store
   Content-Type: text/html;charset=ISO-8859-1
   Content-Length: 1287
   Server: Jetty(7.0.0.v20091005)

Check that the "Server" in the response field is Jetty (and not a load balancer etc.).

Doing tests like these will help narrow down exactly which component has "locked up". Getting a thread dump (with jstack or ctl-\ or jvisualvm) is also invaluable to diagnose what the threads are doing.

Question Mark.png Jetty is using 100% CPU?


Question Mark.png Why do I get a "Save could not be completed" error in Eclipse whenever I try to save a file while Jetty is running?

This is a limitation of Windows -- having a file open in one process means that you can't write to that same file with another process. Since Jetty has mapped the file to its cache, which prevents the file from being edited, you'll need to turn off caching to work around the problem. You can turn off caching in the default servlet by setting <useFileMappedBuffer> to false in webdefault.xml.

Back to the top