Quantcast

java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for java.lang.Exception do not match

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for java.lang.Exception do not match

John Moore
Anyone come across this before? I'm getting an error on the production server which isn't showing up in development, whenever I throw an exception which is a simple subclass of Exception. This is the gist of the error:

"Caused by: java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for java.lang.Exception do not match. Expected 4 but got 5
        at util.PermissionsException.<init>(PermissionsException.groovy:9)"

Here's the class:

class PermissionsException extends Exception {

    public PermissionsException(String message) {
        super(message)
    }
}

Nothing at all out of the ordinary there, and in dev mode it's absolutely fine. I wondered whether it might be to do with developing with JDK 1.6 but running under JDK 1.7 (the only useful thing I could find on Google pointed to something like this), but I've now built the app with JDK 1.7 and the problem is still there. This is with Grails 2.0.4.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for java.lang.Exception do not match

John Moore
Sorted this shortly after posting (always the way). It seems that Java 7 is rather fussier about constructors of superclasses. When I added in a zero-argument constructor to my class it worked fine and the error disappeared. This was not necessary with Java 6.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for java.lang.Exception do not match

John Moore
For some reason, this problem is now back. Building with Java 7, deploying with Java 7, so there should be no problem there. I was able to reproduce it locally, then did a 'grails clean' and the problem has gone away again - for now. Why on earth might a 'grails clean' sort this one out, unless there were classes there built with Java 6 (which there weren't)? I'm worried about this one coming back on the server, so looking for any ideas. I think I may well switch back to Java 6, as I suspect it's something to do with Java 7, but what?
Loading...