I’ve tried to run a Wicket app in an embedded Jetty, using this code:
public static void main( String[] args ){
Server server = new Server(8080);
Context root = new Context( server, "/", Context.SESSIONS );
FilterHolder filterHolder = new FilterHolder( new WicketFilter() );
filterHolder.setInitParameter("applicationClassName", cz.dw.test.WicketApplication.class.getName() );
root.addFilter( filterHolder, "/*" , Handler.ALL );
try {
server.start();
} catch (Exception ex) {
ex.printStackTrace();
}
}
But I got java.lang.UnsupportedClassVersionError: Bad version number in .class file.
Switching the target class version for my app (1.6 -> 1.5) did not help.
I use Sun JDK 1.6.0_17, Wicket 1.4.8, Jetty 6.1.24.
When I run the app normally (deploy to Jetty or mvn jetty:run), it works fine.
I tried to debug, but the JRE classes have no debug data. The stacktrace is of no use as it happens when loading the classes into JVM.
Any ideas what could be wrong?
How can I find which class is causing this?
Thanks,
Ondra
After leaving the IDE, I found out that in
pom.xmlthe version was still 1.6 – so the IDE did not change it; Still, I wonder why this was happening when I positively used JDK 1.6. Perhaps the Jetty plugin changes classloading configuration?Update: So the problem is somewhere between NetBeans, Maven and Maven’s exec plugin. Somehow the exec plugin gets to an environment which’s
javais resolved as/usr/bin/java, which was Sun JDK 1.5.0.I am reporting this as a NetBeans bug.
http://netbeans.org/bugzilla/show_bug.cgi?id=185547