Eclipselink ClassLoading Problem On New() (Doc ID 1534336.1)

Last updated on MARCH 05, 2013

Applies to:

Oracle TopLink - Version 11.1.1.4.0 to 11.1.1.5.0 [Release Oracle11g]
Information in this document applies to any platform.

Symptoms

The below exception occurs intermittently - when starting server or deploying application.  After the exception, the application would go to failed status.

javax.ejb.EJBTransactionRolledbackException: EJB Exception: ; nested exception is: javax.ejb.EJBException: EJB Exception: : java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Error compiling the query [select new hk.org.ha.model.pms.persistence.phs.PatientCat(o.institutionCode, o.patCatCode, o.patCatDesc, o.suspend) from PhsPatientCategory o where o.recordStatus = 'A' order by o.institutionCode, o.patCatCode], line 1, column 7: constructor class [hk.org.ha.model.pms.persistence.phs.PatientCat] not found.
  at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1375)
  at sun.reflect.GeneratedMethodAccessor579.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:106)
  at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:77)
  at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:87)
  at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:18)
  at $Proxy116.createQuery(Unknown Source)
  at sun.reflect.GeneratedMethodAccessor579.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.jboss.seam.persistence.EntityManagerInvocationHandler.handleCreateQueryWithString(EntityManagerInvocationHandler.java:75)
  at org.jboss.seam.persistence.EntityManagerInvocationHandler.invoke(EntityManagerInvocationHandler.java:36)
  at $Proxy214.createQuery(Unknown Source)
  at hk.org.ha.model.pms.asa.biz.phs.PhsServiceBean.retrievePatientCatForPms(PhsServiceBean.java:156)
  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)
  at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)

 

A temporary workaround is to set context classloader before using EntityManager, this way

Thread.currentThread().setContextClassLoader(getClass().getClassLoader());

Bug 309464 - Class loading problem on new() in JPQL

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms