4
votes

I was hoping this would be easier because I just want to do a simple test run with Wicket inside an EAR on GlassFish v3. However now that I have added the Wicket libraries through the netbeans plugin to my WAR project

  • wicket-1.4.10.jar
  • wicket-extensions-1.4.10.jar
  • slf4j-api-1.4.2.jar
  • slf4j-jdk14-1.4.2.jar

I get this startup error when I try to launch my web application on GlassFish:

exception

javax.servlet.ServletException: PWC1243: Filter execution threw an exception root cause

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

Does Wicket need velocity as a dependency? I checked the default project structure created by maven and didnt find the dependency. I also checked a wicket + ejb tutorial which doesnt mention velocity either.

Now that I added velocity to my classpath I get this error:

http://jira.codehaus.org/browse/MSITE-286

This seems to be an issue resolved in 2008 (I used the latest version of course).

Any ideas on what I'm doing wrong?

thanks in advance

1

1 Answers

3
votes

Wicket does not require velocity, though it can collaborate with it, via a wicket-velocity.jar library.

The full stacktrace might help to spot what is trying to load it, though web-application startup issues can be painful to diagnose.

EDIT:

The relevant part of the stacktrace seems to be

java.lang.NoClassDefFoundError: org/apache/velocity/app/Velocity
        at org.apache.wicket.velocity.Initializer.init(Initializer.java:63)
        at org.apache.wicket.Application.callInitializers(Application.java:843)
        at org.apache.wicket.Application.initializeComponents(Application.java:678)
        at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:725)

So the wicket application is definitely trying to load velocity, and we can't blame glassfish. I'm going to switch to a machine where I have the wicket source and come back with maybe more ideas, but it occurs to me that your web.xml might also have useful information on the wicket configuration.

Diagnosis

The web.xml isn't the problem.

The problem is that Application.callInitializers() loads initializers from all wicket.properties files on the classpath and tries to initialize the related components.

You have wicket-velocity.jar on your classpath even though you're not using velocity, and wicket is trying to initialize it as it contains a wicket.properties file causing the call to org.apache.wicket.velocity.Initializer.init() (which is also in wicket-velocity.jar). This method tries to call a static init method in Velocity, which is not on the classpath.

If you get wicket-velocity.jar off your classpath, this issue should go away.