Community
Participate
Working Groups
This JPA 2.0 tests haven't run on Glassfish-v3 (JPA2.0 supported application server) before, this is the first run. There are 97 tests (total 124 test cases) in JPA 2.0 Metamodel test suite failed on Glassfish v3 with the following java.lang.ClassCastException: <error message="org.eclipse.persistence.internal.jpa.metamodel.EntityTypeImpl cannot be cast to org.eclipse.persistence.internal.jpa.metamodel.EntityTypeImpl" type="java.lang.ClassCastException">java.lang.ClassCastException: org.eclipse.persistence.internal.jpa.metamodel.EntityTypeImpl cannot be cast to org.eclipse.persistence.internal.jpa.metamodel.EntityTypeImpl at org.eclipse.persistence.testing.tests.jpa.metamodel.MetamodelMetamodelTest.testAttribute_getPersistentAttributeType_BASIC_Method(MetamodelMetamodelTest.java:524) at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBareServer(JUnitTestCase.java:489) at org.eclipse.persistence.testing.framework.server.TestRunnerBean.runTest(TestRunnerBean.java:87) at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052) at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124) at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5239) at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:610) at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797) at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:562) at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157) at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:139) at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858) at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797) at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:367) at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5211) at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5199) at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:201) at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:75) at $Proxy127.runTest(Unknown Source) at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie.dispatchToMethod(ReflectiveTie.java:146) at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:176) at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:682) at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:216) at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1841) at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1695) at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1078) at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:221) at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:797) at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:561) at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2558) at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:492) at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:528) </error> Seems there are some class loading issues with Glassfish-v3, but need to investigate deeply.
>I suspect that is is a classLoader issue where 2 versions of the eclipselink.jar library are being used. Usually when we get a [packageA.classA cannot be cast to packageA.ClassA] where the classes are identical - it is a classLoader issue - we need to check that the [org.eclipse.persistence.jpa.jar] library as part of the 5 org.eclipse.persistence.* jars in the GlassFish V3 glassfish/modules is the only library being used by the test suite. - we also need to verify that all the server SSB and client use that same library
>line is EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl)metamodel.entity(Manufacturer.class); >this is better EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl<Manufacturer>)metamodel.entity(Manufacturer.class); >this will work with only interfaces EntityType<Manufacturer> entityManufacturer_ = (EntityType<Manufacturer>)metamodel.entity(Manufacturer.class); >as will this (avoiding the cast) which is an even better and a quick fix (without fixing why we get the CCE) EntityType<Manufacturer> entityManufacturer_ = metamodel.entity(Manufacturer.class);
>see related deferred bugs bug# 296269 : JPA 2.0: Add GlassFish V3 configuration process to enable the JPA 2.0 library functionality bug# 297711 : Build: Glassfish library override requires new build-eclipselink-bundle-jars
Since the bug 311606 (org.eclipse.persistence.internal.jpa.metamodel was missed in "Export-Package" for org.eclipse.persistence.jpa_2.1.0.qualifier.jar), all files with package org.eclipse.persistence.internal.jpa.metamodel couldn't be loaded on Glassfish-v3 when using "org.eclipse.persistence.jpa_2.1.0.qualifier.jar". By manually adding package org.eclipse.persistence.internal.jpa.metamodel in in MANIFEST.MF within this jar, also remove eclipselink.jar from Glassfish\domains\<domain_name>\lib, all metamodel tests passed. The second fix (in glassfish.xml) was checked in trunk, revision#: 7151 Code reviewed by: Edwin Tang.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink