CannotCompileException with ibm jdk within websphere 8.x application server

71 views
Skip to first unread message

Patrizio De Michele

unread,
May 5, 2016, 10:04:30 AM5/5/16
to JMapper Framework
Hi Guys, i'm facing a "compilation error" in websphere both 8.0 and 8.5.5 with IBM jdk 1.6.
I have made some new mapping using the "nested mapping" so i'm switched from jmapper 1.4.2 to 1.6.0.1.
Everything seems ok with tomcat but when i have installed the ear inside websphere i have received an exception
coming from a call to a native method of the ibm jvm from the Classloader class.
The final, and important part, of the stacktrace follows:

Caused by: javassist.CannotCompileException: by java.lang.ClassFormatError: JVMCFRE045 indice del pool di costanti non compreso nell'intervallo; classe=itmydestinationclassitmysourceclass, offset=48931
    at javassist.ClassPool.toClass(ClassPool.java:1085)
    at javassist.ClassPool.toClass(ClassPool.java:1028)
    at javassist.ClassPool.toClass(ClassPool.java:986)
    at javassist.CtClass.toClass(CtClass.java:1110)
    at com.googlecode.jmapper.generation.JavassistGenerator.generate(JavassistGenerator.java:78)
    at com.googlecode.jmapper.generation.MapperGenerator.generateMapperClass(MapperGenerator.java:76)
    at com.googlecode.jmapper.generation.MapperBuilder.generate(MapperBuilder.java:88)
    at com.googlecode.jmapper.JMapper.createMapper(JMapper.java:431)
    at com.googlecode.jmapper.JMapper.<init>(JMapper.java:413)
    ... 88 more
Caused by: java.lang.ClassFormatError: JVMCFRE045 indice del pool di costanti non compreso nell'intervallo; classe=itmydestinationclassitmysourceclass, offset=48931
    at java.lang.ClassLoader.defineClassImpl(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:264)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:201)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    at java.lang.reflect.Method.invoke(Method.java:611)
    at javassist.ClassPool.toClass2(ClassPool.java:1098)
    at javassist.ClassPool.toClass(ClassPool.java:1079)
    ... 96 more

I have tried to compile with ibm jdk and run tomcat with ibm jdk but the problem is not present with tomcat.
I have also tried to use jmapper 1.6.0/1.5.0, guava 18.0(suggested from reflections pom)/15.0.cdi, javassist 3.17.1,3.19,3.20.
Nothing works i always receive the same error.

Any suggest it's wellcome.

Thank you in advance, Patrizio

Alessandro Vurro

unread,
May 5, 2016, 10:41:39 AM5/5/16
to JMapper Framework
Hi Patrizio,

This is a common issue related to WebSphere. 
You must define the code density in seguential mode
In the overview you can see how it work and after how to set in java for example.

I hope it can be useful

Patrizio De Michele

unread,
May 5, 2016, 11:01:23 AM5/5/16
to JMapper Framework
Hi Alessandro,
I have already tried (i forgot to mention it in my previous post!) the solution you suggested.
I don't know if websphere is considering the property that seems strictly related to ILOG.
I can try to set 0.1 instead of 0.5 because the error is in the "biggest" class that is about 662K,
maybe is size related.
Currenty i'm debugging trying to see from the class if the value of consant pool count is correct.

Bye, Patrizio

PS i don't know javaassist, so i'm just guessing, but seems to me that in class JavassistGenerator in the method generate
if an exception happens in the line --> Class<?> generetedClass = cc.toClass(); the cc.defrost(); is skipped, infact if i try to restart
the application in websphere and the second time it says that class is "frozen", maybe the defrost is better in a finally block?

Alessandro Vurro

unread,
May 5, 2016, 11:22:34 AM5/5/16
to JMapper Framework
good point, i will modify the code as you suggested.

Thank you!

Patrizio De Michele

unread,
May 6, 2016, 7:14:05 AM5/6/16
to JMapper Framework
Seems effectively the problem is .related to the size of the class added into classloader.
Sadly seems that websphere ignores the property so i have solved removing a nested mapping and doing it with another jmapper mapping.

I have a question, do you believe is it possible to create an internal private class or a new class in the case of  "nested mappings"?
I Believe this will "solve" the problem in most cases. I'm asking about nested mappings because obviously going deep into the classes structure
implies a big sized mapping class.

TGIF,
         Patrizio


Il giorno giovedì 5 maggio 2016 16:41:39 UTC+2, Alessandro Vurro ha scritto:
Reply all
Reply to author
Forward
0 new messages