Saturday, 15. August 2009
Jetty and the NoSuchMethodError (2)
How can classpath problems like the NoSuchMethodError described yesterday be found? The answer to this question can be found with the ClasspathMonitor provided by PatternTesting. All you need is to add patterntesting-rt-xxx.jar from PatternTesting Runtime to your classpath and to register the ClasspathMonitor as MBean:
public static void main(String[] args) throws Exception {
    ClasspathMonitor.registerAsMBean();
    Runner runner = new Runner();
    runner.start();
}

If you start the application you have to add the options
  • -Dcom.sun.management.jmxremote.local.only=false
  • -Dcom.sun.management.jmxremote
for JMX otherwise you would not see your application in the list of started java processes when you open JMX console.

Start your program and then the jconsole. The jconsole is since Java 5 part of the JDK. When you open the MBeans tab you can find the ClasspathMonitor MBean under the patterntesting folder. As you can guess on the screenshot below the ClasspathMonitor found an incompatible class org.apache.jasper.compiler.Localizer, i.e. this class was found more than once in the classpath (in jasper-compiler-5.5.9.jar and jasper-runtime-5.5.9.jar) but with different versions.



I don't know why I had used this version of Jasper. After I upgraded to Jasper 5.5.15 my JSP page appears without an error.

to be continued...

... link (0 Kommentare)   ... comment