Resin 3.0

Web Applications
Servlets and Filters
Admin (JMX)
EJB 3.0


A list of symptoms and their possible resolution.

  1. Resin stops responding
  2. Resin keeps restarting
  3. No line numbers in exception stack traces
  4. java.lang.OutOfMemoryError exception, application runs out of memory
  5. After a while the server starts to go very slow
  6. CPU spikes, excessive CPU usage
  7. Sessions become null, losing session
  8. Specification version 1.3 of package javax.servlet, J2EE Specification, version 1.3 is not compatible with Resin
  9. Unsupported major.minor version 48.0

Resin stops responding

Resin keeps restarting

  • Enable full debug logging and check the entries for an explanation of why Resin thinks it should restart.

No line numbers in exception stack traces

  • In resin.conf specify -g as an option for Resin to pass to the java compiler:

    -g compiler option
    <java compiler='javac' compiler-args='-g'/>

  • Specify -nojit as a command-line option when starting Resin:

    -nojit command-line options
    win> bin/httpd.exe -nojit
    unix> bin/ -nojit

java.lang.OutOfMemoryError exception, application runs out of memory

  • Use JVM startup arguments to increase heap memory.
  • Obtain a heap dump to determine which objects are not getting garbage collected.
  • Obtain a thread dump and check for unreleased threads that might be holding onto objects.

An OutOfMemoryError exception is usually an indication that heap memory is being used up. Often this is from application code keeping references to objects that are no longer needed, and the garbage collector does not free them. A heap dump can help determine which code and which kinds of objects are being held.

If the heap dump or other monitoring tools reveal that the server and your appliciation(s) actually are not running out of heap memory then an OutOfMemoryError indicates that then the JVM is running out of virtual memory, i.e. an underlying malloc() call is failing.

Often this situation is indicated by using OS tools to show memory usage, the JVM itself indicates it has heap memory but the OS tool shows that the process is using a very large amount of memory. On Windows the task manager is used, on Unix top or ps.

The only non-heap allocations by the JVM (and therefore Resin and your application) are the following:

  • threads and particularly the thread stack takes up virtual memory
  • any JNI libraries might be calling malloc or mmap (or the windows equivalent of mmap) and taking virtual memory. This includes many database drivers, and also some JNI code that Resin uses.
  • for .jar/.zip files (specifically ZipFile), the JDK allocates virtual memory. If you have a large number of jars open, you can run into problems. It's conceivable that a getResourceAsStream for a jar file that wasn't closed would use up .jar memory.

After a while the server starts to go very slow

  • This may be a garbage collection issue. If you have a memory leak, then an excessive number of objects may get created, causing the garbage collector to use up all of your CPU. If you're running out of memory, then the JVM will slowly halt (and continually GC) until it dies.
  • This may be a runaway thread or a request that is tying up resources. If a thread does not return from a request, Resin will not be able to reuse the thread and will have less threads to service new requests.
    • Obtain a thread dump and check for unreleased threads that might be holding onto objects.

CPU spikes, excessive CPU usage

Sessions become null, losing session

URL rewriting

If you forget to rewrite a URL, a user who requires rewriting will lose their session as soon as they follow that URL.

Resin establishes an association between a session and a user's browser by establishing a unique id that is returned back with each new request. This is accomplished in one of two ways: using cookies or URL rewriting.

Resin first attempts to track the session of a user by sending the user's browser a cookie containing the unique session id.

Sometimes Resin cannot establish a cookie, either because the user has disabled cookies in their browser or because the browser does not support them (as is the case with some HDML and WML browsers). If the cookie cannot be established then something called URL rewriting is used.

In this case, Resin rewrites every URL that it submits to the user so that it contains a parameter named _jsessionid. Then for each incoming request the first thing it does is look for this parameter, and if it is available it knows a session has been established and it removes the parameter and uses it to find the users session object.

Rewriting requires the cooperation of the developer. The developer must encode every URL reference so that Resin has an opportunity to put in the _jsessionid parameter.

URL rewriting using JSTL
<%@ taglib prefix='c' uri='' %>

Time to go <a href="<c:url value='home.jsp'/>">Home</a>!

URL rewriting using Java scriptlet
String homeUrl = response.encodeURL("home.jsp");

<%-- the presentation --%>

Time to go <a href="<%= homeUrl %>">Home</a>!

Resin configuration for sessions

Another possiblity is that the <session-max> setting is too low, and you are getting more users establishing sessions than you have configured Resin for.

Yet another possibility is that the session is timing out, you can use the <session-timeout> tag to configure this.

<web-app id='/'>
    <!-- timeout after 120 minutes -->
    <!-- up to 4096 sessions at once -->

Application reloading

Whenever a java source file, web.xml, or resin.conf changes then Resin will restart the application. If this happens, your current sessions will be lost unless you have configured a persistent session store.

Browser cookie limitations

Some users have reported that if their applciation uses a lot of cookies, the browser will start to discard older cookies to make room for the new. This may result in the browser discarding the cookie that Resin is using to keep track of the session.

If your application uses a lot of cookies, you may need to configure Resin to always use URL rewritting by setting <enable-cookies> to false.

<web-app id='/'>

Problems with cookie domains

You may also lose your sessions if your cookie domains are incompatible. For example, if you have one server that uses cookie domain "" and another that uses "", the cookie in the browser for "" will interfere with sessions on "". The solution is to change the cookie domain "" to "".

You set the cookie domain in <session-config> . (Thanks Laura for providing this)

Conflicting cookie names

If you are using Resin and another application server (such as Tomcat), you may encounter a conflict because both of them are using the same cookie name (usually JSESSIONID) for the session tracking cookie.

Resin provides <session-cookie> to let you change the name of the cookie that Resin uses.

Change the name of the cookie used for session tracking



Specification version 1.3 of package javax.servlet, J2EE Specification, version 1.3 is not compatible with Resin

See Clean up the classpath

Unsupported major.minor version 48.0

This error usually happens when a conflicting jar is found, see Clean up the classpath

If the classpath is completely cleaned up, as suggested in the link, then a jar or some other component of a jdk installation or older Resin installation is coming from somewhere else.

There may be a problem with some jar in your JAVA_HOME tree, if you have added anything there. There may be a conflicting jar in WEB-INF/lib/ of your webapp.

Another possibility is that you have not set JAVA_HOME, or if you have then some component of a conflicting jdk installation (javac for example, or the java executable itself) is getting used.

If on windows, check for stray copies of java.exe outside of JAVA_HOME, for example in C:/WINDOWS/java.exe or anywhere else in your PATH.

Copyright © 1998-2006 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.