Dear group,

I just started to try using OpenEJB for testing my EJB beans. So, I'm
pretty beginner with OpenEJB (and OpenJPA).
I hit the next exception (what I cannot overcome) in my test using
OpenEJB's ApplicationComposer:
Exception stacktrace:
Caused by: java.rmi.RemoteException: The bean encountered a non-application
exception; nested exception is:
    <openjpa-2.2.0-r422266:1244990 fatal general error>
org.apache.openjpa.persistence.PersistenceException: null
    at
org.apache.openejb.core.transaction.EjbTransactionUtil.handleSystemException(EjbTransactionUtil.java:154)
    ... 43 more
Caused by: <openjpa-2.2.0-r422266:1244990 fatal general error>
org.apache.openjpa.persistence.PersistenceException: null
    at
org.apache.openjpa.enhance.ClassRedefiner.redefineClasses(ClassRedefiner.java:96)
    at
org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:176)
    at
org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:314)
    at
org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:238)
    at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212)
    at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
    at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
    at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
    at
org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createEntityManager(ReloadableEntityManagerFactory.java:160)
    at
org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:115)
    at
org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:80)
    at
org.apache.openejb.persistence.JtaEntityManager.getMetamodel(JtaEntityManager.java:475)
    at
com.newmainsoftech.jecommerce.dao.impl.AbstractFacadeImpl.postConstruct(AbstractFacadeImpl.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
    at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$LifecycleInvocation.invoke(ReflectionInvocationContext.java:213)
    at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
    at
org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:176)
    at
org.apache.openejb.monitoring.StatsInterceptor.PostConstruct(StatsInterceptor.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
    at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
    at
org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:138)
    at org.apache.openejb.BeanContext.newInstance(BeanContext.java:1478)
    ... 42 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.openjpa.enhance.*
ClassRedefiner.redefineClasses(ClassRedefiner.java:85)*
    ... 71 more
Caused by: java.lang.VerifyError
    at sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
    at
sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:144)
    ... 76 more

Statement throwing exception in the test method:
@Test
public void test_create() {
    final String testName = JUnitAssistAspect.getTestName();

    final Category category = new Category();
        category.setName( testName);

    final CategoryFacade categoryFacade = getCategoryFacade();
    categoryFacade.create( category); // <-- Exception is thrown at here!
    ...
}

I traced and dumped the calls from ClassRedefiner.redefineClasses to
reflect.Method.invoke:
16:27:24.078 [main] INFO
c.n.j.d.i.AbstractCategoryFacadeImplTest$CreateEntityManagerDebugTraceAspect
-
Invocation start : org.apache.openjpa.enhance.*
ClassRedefiner.redefineClasses*(

conf(type:JDBCConfigurationImpl)=org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@7a44ac1a
,
    *classes(type:HashMap)={
        class com.newmainsoftech.jecommerce.dao.entity.Product*=[B@9d8e7b*,
        class com.newmainsoftech.jecommerce.dao.entity.OrderedProductPK*
=[B@1f54525*,
        class com.newmainsoftech.jecommerce.dao.entity.Supplier*=[B@18eb67b*,

        class com.newmainsoftech.jecommerce.dao.entity.Customer*=[B@6e7953*,

        class com.newmainsoftech.jecommerce.dao.entity.OrderedProduct*
=[B@df77f7*,
        class com.newmainsoftech.jecommerce.dao.entity.Category*=[B@13d164c*,

        class com.newmainsoftech.jecommerce.dao.entity.CustomerOrder*
=[B@1830452*,
        class com.newmainsoftech.jecommerce.dao.entity.ContactBase*
=[B@90daa2*
        }*
    ) @ ClassRedefiner.java:55

16:27:24.078 [main] INFO
c.n.j.d.i.AbstractCategoryFacadeImplTest$RedefineClassesDebugTraceAspect -
Invocation start : java.lang.reflect.Method.invoke(

arg0(type:InstrumentationImpl)=sun.instrument.InstrumentationImpl@17b930d,
    arg1(type:Object[])=[org.apache.openjpa.enhance.ClassRedefiner$1@1f378ca,
true]
    ) @ ClassRedefiner.java:82
16:27:24.078 [main] INFO
c.n.j.d.i.AbstractCategoryFacadeImplTest$RedefineClassesDebugTraceAspect -
Invocation end : java.lang.reflect.Method.invoke(

arg0(type:InstrumentationImpl)=sun.instrument.InstrumentationImpl@17b930d,
    arg1(type:Object[])=[org.apache.openjpa.enhance.ClassRedefiner$1@1f378ca,
true]
    ) @ ClassRedefiner.java:82
Returned null

16:27:24.078 [main] INFO
c.n.j.d.i.AbstractCategoryFacadeImplTest$RedefineClassesDebugTraceAspect -
Invocation start : java.lang.reflect.*Method.invoke*(
    *arg0*(type:InstrumentationImpl)=*sun.instrument.InstrumentationImpl*
@17b930d,
    *arg1*(type:Object[])=*[[Ljava.lang.Class;@17f2629]*
    ) *@ ClassRedefiner.java:85*

It's puzzling me why sun.instrument.InstrumentationImpl.retransformClasses
method throws the VerifyError exception, since, from the above dump, it
appeared to me that the array local field in the
ClassRedefiner.redefineClasses method holds the array of the proper entity
bean classes.

Environment:
OpenEJB ver 4.5.2
OpenJPA ver 2.2.0 (as resolved openjpa-asm-shaded dependency from
openejb-core artifact dependency)
EJB 3
JDK 1.7.0
Windows box

Can someone shed the guiding light?
I appreciate any advises since I am pretty beginner of OpenEJB (and
OpenJPA).

Regards,
Art

Reply via email to