This content has been marked as final.
Show 5 replies
-
1. Re: Illegal class modifiers
starksm64 Dec 9, 2006 11:28 AM (in response to wessan)Full details of the issue are needed:
http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossHelp -
2. Re: Illegal class modifiers
wessan Dec 9, 2006 12:09 PM (in response to wessan)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. -
3. Re: Illegal class modifiers
starksm64 Dec 9, 2006 12:31 PM (in response to wessan)More than that is needed. An example of how to reproduce the problem in a jira issue is what is needed.
http://jira.jboss.com/jira/browse/JASSIST -
4. Re: Illegal class modifiers
wessan Dec 10, 2006 9:08 AM (in response to wessan)Ok ... I'll try extract a working example as soon as I'll have time ... I have tried removing final keyword from the class declaration and now it works. So I guess that the problem is caused by final keyword in the original class.
-
5. Re: Illegal class modifiers
wessan Dec 10, 2006 9:10 AM (in response to wessan)OK ... ignore the topic, I think I have already found the problem. I guess it's on my side afterall.