These are possible issues and solutions that may be encountered when using the JRocket Java VM:

java.lang.NoClassDefFoundError: org/apache/velocity/app/VelocityEngine

When loading the Struts 2 filter, you may get this exception in your logs, preventing Struts 2 from starting correctly:

<Oct 3, 2007 8:07:21 AM EDT> <Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.FilterDispatcher.
java.lang.NoClassDefFoundError: org/apache/velocity/app/VelocityEngine
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(
at java.lang.Class.getDeclaredFields(
at com.opensymphony.xwork2.inject.ContainerImpl.addInjectors( 

The JRocket VM seems to load classes differently than the Sun JVM by more eagerly loading classes that aren't meant to be loaded. Velocity-related classes, such as the one used by the VelocityManager class that is the ultimate cause of this exception, should only be loaded lazily, as Velocity is officially an optional dependency for Struts. JRocket seems to trigger the loading earlier on startup.


Add the Velocity jars in your application's classpath and the problem will go away. If you are using Maven 2, insert the following XML into your POM:

  • No labels