[jboss-user] [Javassist user questions] - Re: Illegal class modifiers

wessan do-not-reply at jboss.com
Sat Dec 9 12:09:53 EST 2006


OK ... this is as much deatils as I can provide:

This is an example exception thrown:
Exception in thread "main" java.lang.ClassFormatError: Illegal class modifiers in class test/cz/solari/shards/example/app1/EmployeeImpl: 0x431
  | 	at java.lang.ClassLoader.defineClass1(Native Method)
  | 	at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
  | 	at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
  | 	at cz.solari.shards.loader.Loader.findClass(Loader.java:136)
  | 	at cz.solari.shards.loader.Loader.loadClass(Loader.java:70)
  | 	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
  | 	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
  | 	at test.cz.solari.shards.source.DefaultSourceTest.main(DefaultSourceTest.java:23)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:597)

It seems that the generated bytecode is incorrect. The code passed to defineClass method is generated using CtClass.toByteCode() method. The class may be altered (fields/methods may be added) by the custom ClassLoader however the class modifiers are never changed. It seems that Javassist doesn't throw any excetion during compilation, just the ClassLoader does.
I tried it with both JDK 1.6 and JDK 1.5 with both of them the same exception is thrown.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992436#3992436

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992436



More information about the jboss-user mailing list