2008年5月9日金曜日

[Groovy>Grails] IncompatibleClassChangeError error when starting jetty server in grails development environment

Description
I useally use the Java environment based on Sun's JDK when using grails and groovy, but sometimes I change the JDK from Sun's to IBM's to check the behavior and performance. After changing the IBM's JDK, following error occures when starting up the jetty application server on grails environment.

Error Detail
Failed startup of context org.mortbay.jetty.webapp.WebAppContext@3c003c{/test,/home/admin/test/web-app}
org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for java.lang.Thread do not match. Expected 8 but got 9.

Solution
This error occures because the runtime of java version or provider(Sun, IBM or others) is different from the version of compiled jdk environment. In my case, I compile the grails source code based on Sun's jdk(Ver.1.5), and then I change the JDK from Sun to IBM(Ver.1.5) without recompiling my java source codes. Maybe the IBM internal classes using in the JDK is different from the Sun's. In this case, the error is resolved after clearing all old compiled class files and recompile all classes by using new java compiler.

0 件のコメント: