Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-572

PersistenceUnitInfo.getNewTempClassLoader()

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Rejected
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      The sooner the better.
      Hibernate can't enhance the classes to make property (not association) lazy loading.
      Toplink just can't start.

      http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3939615#3939615

        Gliffy Diagrams

          Activity

          Hide
          mfobrien Michael O'Brien added a comment -

          Hi,
          The following workaround has been checked in for EclipseLink M8 to work with JBoss 4.2.2 GA.
          Container managed entities should predeploy/deploy and register now with/without static weaving.
          When the UCL3 classLoader no longer causes a NPE we will reenable dynamic weaving on EAR predeploy().

          http://bugs.eclipse.org/229634

          Workaround:
          ---------------------------------
          EclipseLink will use the non-temporary classLoader instead of the one from getNewTempClassLoader() obtained from the JBoss PersistenceUnitInfo that throws a NPE on loadClass() or Class.forName().
          We require that JBoss implementers statically weave container managed entities and reference JBoss as the target-server in persistence.xml.

          Deployment Changes:
          1) If weaving is required then static weave the entities before EAR packaging using either the command-line weaver or the weaving ant task.
          2) All persistence units deployed to the JBoss container must contain the following property in persistence.xml or container managed entities will predeploy but fail to be managed at runtime.

          <property
          name="eclipselink.target-server"
          value="org.eclipse.persistence.platform.server.jboss.JBossPlatform"/>

          JBoss AS 4.2.2 GA debugging:
          ----------------------------------------------------------
          I debugged the UCL3 NullPointerException into the JBoss AS 4.2.2 GA source into the following segment of code.

          In the following function the classloader parent tree is searched all the way to the root.
          no clazz is returned and in the finally clause the last log.trace causes a RuntimeException on a NPE.
          Curious though that the line number in Logger.trace() does not correspond to the JDK 1.5 src.

          package org.jboss.mx.loading
          public abstract class RepositoryClassLoader extends URLClassLoader
          public Class loadClass(String name, boolean resolve)
          throws ClassNotFoundException
          {
          boolean trace = log.isTraceEnabled();
          if (trace)
          log.trace("loadClass " + this + " name=" + name+", loadClassDepth="+loadClassDepth);
          Class clazz = null;
          try
          {
          if (repository != null)
          {
          clazz = repository.getCachedClass(name);
          if (clazz != null)
          {
          if( log.isTraceEnabled() )

          { StringBuffer buffer = new StringBuffer("Loaded class from cache, "); ClassToStringAction.toString(clazz, buffer); log.trace(buffer.toString()); }

          return clazz;
          }
          }
          clazz = loadClassImpl(name, resolve, Integer.MAX_VALUE);
          return clazz;
          }
          finally
          {
          if (trace)

          { if (clazz != null) log.trace("loadClass " + this + " name=" + name + " class=" + clazz + " cl=" + clazz.getClassLoader()); else --->NPE log.trace("loadClass " + this + " name=" + name + " not found"); }

          }
          }

          Thread [main] (Suspended)
          UnifiedClassLoader3(RepositoryClassLoader).loadClass(String, boolean) line: 425
          UnifiedClassLoader3(ClassLoader).loadClass(String) line: 251
          UnifiedClassLoader3(ClassLoader).loadClassInternal(String) line: 319
          Class<T>.forName0(String, boolean, ClassLoader) line: not available [native method]
          Class<T>.forName(String, boolean, ClassLoader) line: 242
          PrivilegedAccessHelper.getClassForName(String, boolean, ClassLoader) line: 85
          XMLEntityMappings.getClassForName(String, ClassLoader) line: 120
          XMLEntityMappings.getClassForName(String) line: 157
          XMLEntityMappings.initPersistenceUnitClasses() line: 389
          MetadataProcessor.initPersistenceUnitClasses() line: 188
          MetadataProcessor.processEntityMappings() line: 298

          Results:
          --------
          15:41:43,772 INFO [STDOUT] [EPS Warning]: 2008.05.02 15:41:43.755-Thread(Thread[main,5,jboss])-The temporary classLoader for PersistenceLoadProcessor [helloworld] is not available. Switching classLoader to [org.jboss.mx.loading.UnifiedClassLoader3@18b995c

          { url=file:/C:/opt/jboss422/server/default/tmp/deploy/tmp13465jsfejb3.ear ,addedOrder=45}

          ]. Weaving has been disabled for this session. EclipseLink may be unable to get a spec mandated temporary class loader from the server, you may be able to use static weaving as an optional workaround.
          15:41:44,221 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=jsfejb3.ear,jar=app.jar,name=TodoDao,service=EJB3 with dependencies:
          15:41:44,221 INFO [JmxKernelAbstraction] persistence.units:ear=jsfejb3.ear,jar=app.jar,unitName=helloworld
          15:41:44,359 INFO [EJBContainer] STARTED EJB: TodoDao ejbName: TodoDao
          15:42:45,344 INFO [STDOUT] [EPS Finer]: 2008.05.02 15:42:45.343-UnitOfWork(20862427)Thread(Thread[http-127.0.0.1-8080-1,5,jboss])-TX binding to tx mgr, status=STATUS_ACTIVE
          15:42:45,344 INFO [STDOUT] [EPS Finest]: 2008.05.02 15:42:45.344-UnitOfWork(20862427)Thread(Thread[http-127.0.0.1-8080-1,5,jboss])-Execute query DoesExistQuery()
          15:42:45,350 INFO [STDOUT] [EPS Finest]: 2008.05.02 15:42:45.350-UnitOfWork(20862427)Thread(Thread[http-127.0.0.1-8080-1,5,jboss])-PERSIST operation called on: Todo@15914f3.

          thank you
          /michael

          Show
          mfobrien Michael O'Brien added a comment - Hi, The following workaround has been checked in for EclipseLink M8 to work with JBoss 4.2.2 GA. Container managed entities should predeploy/deploy and register now with/without static weaving. When the UCL3 classLoader no longer causes a NPE we will reenable dynamic weaving on EAR predeploy(). http://bugs.eclipse.org/229634 Workaround: --------------------------------- EclipseLink will use the non-temporary classLoader instead of the one from getNewTempClassLoader() obtained from the JBoss PersistenceUnitInfo that throws a NPE on loadClass() or Class.forName(). We require that JBoss implementers statically weave container managed entities and reference JBoss as the target-server in persistence.xml. Deployment Changes: 1) If weaving is required then static weave the entities before EAR packaging using either the command-line weaver or the weaving ant task. 2) All persistence units deployed to the JBoss container must contain the following property in persistence.xml or container managed entities will predeploy but fail to be managed at runtime. <property name="eclipselink.target-server" value="org.eclipse.persistence.platform.server.jboss.JBossPlatform"/> JBoss AS 4.2.2 GA debugging: ---------------------------------------------------------- I debugged the UCL3 NullPointerException into the JBoss AS 4.2.2 GA source into the following segment of code. In the following function the classloader parent tree is searched all the way to the root. no clazz is returned and in the finally clause the last log.trace causes a RuntimeException on a NPE. Curious though that the line number in Logger.trace() does not correspond to the JDK 1.5 src. package org.jboss.mx.loading public abstract class RepositoryClassLoader extends URLClassLoader public Class loadClass(String name, boolean resolve) throws ClassNotFoundException { boolean trace = log.isTraceEnabled(); if (trace) log.trace("loadClass " + this + " name=" + name+", loadClassDepth="+loadClassDepth); Class clazz = null; try { if (repository != null) { clazz = repository.getCachedClass(name); if (clazz != null) { if( log.isTraceEnabled() ) { StringBuffer buffer = new StringBuffer("Loaded class from cache, "); ClassToStringAction.toString(clazz, buffer); log.trace(buffer.toString()); } return clazz; } } clazz = loadClassImpl(name, resolve, Integer.MAX_VALUE); return clazz; } finally { if (trace) { if (clazz != null) log.trace("loadClass " + this + " name=" + name + " class=" + clazz + " cl=" + clazz.getClassLoader()); else --->NPE log.trace("loadClass " + this + " name=" + name + " not found"); } } } Thread [main] (Suspended) UnifiedClassLoader3(RepositoryClassLoader).loadClass(String, boolean) line: 425 UnifiedClassLoader3(ClassLoader).loadClass(String) line: 251 UnifiedClassLoader3(ClassLoader).loadClassInternal(String) line: 319 Class<T>.forName0(String, boolean, ClassLoader) line: not available [native method] Class<T>.forName(String, boolean, ClassLoader) line: 242 PrivilegedAccessHelper.getClassForName(String, boolean, ClassLoader) line: 85 XMLEntityMappings.getClassForName(String, ClassLoader) line: 120 XMLEntityMappings.getClassForName(String) line: 157 XMLEntityMappings.initPersistenceUnitClasses() line: 389 MetadataProcessor.initPersistenceUnitClasses() line: 188 MetadataProcessor.processEntityMappings() line: 298 Results: -------- 15:41:43,772 INFO [STDOUT] [EPS Warning] : 2008.05.02 15:41:43.755- Thread(Thread [main,5,jboss] ) -The temporary classLoader for PersistenceLoadProcessor [helloworld] is not available. Switching classLoader to [org.jboss.mx.loading.UnifiedClassLoader3@18b995c { url=file:/C:/opt/jboss422/server/default/tmp/deploy/tmp13465jsfejb3.ear ,addedOrder=45} ]. Weaving has been disabled for this session. EclipseLink may be unable to get a spec mandated temporary class loader from the server, you may be able to use static weaving as an optional workaround. 15:41:44,221 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=jsfejb3.ear,jar=app.jar,name=TodoDao,service=EJB3 with dependencies: 15:41:44,221 INFO [JmxKernelAbstraction] persistence.units:ear=jsfejb3.ear,jar=app.jar,unitName=helloworld 15:41:44,359 INFO [EJBContainer] STARTED EJB: TodoDao ejbName: TodoDao 15:42:45,344 INFO [STDOUT] [EPS Finer] : 2008.05.02 15:42:45.343- UnitOfWork(20862427) Thread(Thread [http-127.0.0.1-8080-1,5,jboss] ) -TX binding to tx mgr, status=STATUS_ACTIVE 15:42:45,344 INFO [STDOUT] [EPS Finest] : 2008.05.02 15:42:45.344- UnitOfWork(20862427) Thread(Thread [http-127.0.0.1-8080-1,5,jboss] ) -Execute query DoesExistQuery() 15:42:45,350 INFO [STDOUT] [EPS Finest] : 2008.05.02 15:42:45.350- UnitOfWork(20862427) Thread(Thread [http-127.0.0.1-8080-1,5,jboss] ) -PERSIST operation called on: Todo@15914f3. thank you /michael
          Hide
          alesj Ales Justin added a comment -

          Re-assigning to Scott, since this is UCL3 usage issue.

          Show
          alesj Ales Justin added a comment - Re-assigning to Scott, since this is UCL3 usage issue.
          Hide
          ringerc Craig Ringer added a comment -

          Looks like this has been languishing for about four years. Does it need to be closed/fixed, or does the bug still exist?

          When deploying EclipseLink 2.3.2 as a JBoss module on JBoss AS 7, I encounter the following error from EclipseLink:

          The temporary classLoader for PersistenceLoadProcessor [xxxx-PU] is not available. Switching classLoader to [ModuleClassLoader for Module "deployment.xxxxx.war:main" from Service Module Loader]. Weaving has been disabled for this session. EclipseLink may be unable to get a spec mandated temporary class loader from the server, you may be able to use static weaving as an optional workaround.

          Research on that error takes me to:

          http://wiki.eclipse.org/EclipseLink/Examples/JPA/Migration/JBoss

          which suggests that the issue remains, but is also fairly old.

          Applying the workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=365704 (see my comment in that bug) allows EclipseLink to see the JBoss AS 7 JTA, but doesn't affect weaving/enrichment issues.

          Show
          ringerc Craig Ringer added a comment - Looks like this has been languishing for about four years. Does it need to be closed/fixed, or does the bug still exist? When deploying EclipseLink 2.3.2 as a JBoss module on JBoss AS 7, I encounter the following error from EclipseLink: The temporary classLoader for PersistenceLoadProcessor [xxxx-PU] is not available. Switching classLoader to [ModuleClassLoader for Module "deployment.xxxxx.war:main" from Service Module Loader] . Weaving has been disabled for this session. EclipseLink may be unable to get a spec mandated temporary class loader from the server, you may be able to use static weaving as an optional workaround. Research on that error takes me to: http://wiki.eclipse.org/EclipseLink/Examples/JPA/Migration/JBoss which suggests that the issue remains, but is also fairly old. Applying the workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=365704 (see my comment in that bug) allows EclipseLink to see the JBoss AS 7 JTA, but doesn't affect weaving/enrichment issues.
          Hide
          smarlow Scott Marlow added a comment -

          Craig,

          I believe that this issue is out of date but I'm not 100% sure (with regard to whether further code changes are going into EJBTHREE).

          EJBTHREE-572 was intended to be fixed for AS5/AS6 but is not relevant for AS7. AS7 issues should be created at https://issues.jboss.org/browse/AS7.

          AS7 does have an implementation of PersistenceUnitInfo.getNewTempClassLoader(), AS5/AS6 didn't.

          https://issues.jboss.org/browse/AS7-4996 is a related issue (PersistenceUnitInfo.addTransformer() needs more work) and could be the cause of the "temporary classloader ... is not available" error. The error message looks very nice but I'm wondering if its theory as to the likely cause, is wrong. I have some ideas for fixing AS7-4996, which could help your test also.

          Can we please continue this discussion in the AS7 forums. Thanks for continuing to push on EclipseLink integration and these issues! Much appreciated!

          Show
          smarlow Scott Marlow added a comment - Craig, I believe that this issue is out of date but I'm not 100% sure (with regard to whether further code changes are going into EJBTHREE). EJBTHREE-572 was intended to be fixed for AS5/AS6 but is not relevant for AS7. AS7 issues should be created at https://issues.jboss.org/browse/AS7 . AS7 does have an implementation of PersistenceUnitInfo.getNewTempClassLoader(), AS5/AS6 didn't. https://issues.jboss.org/browse/AS7-4996 is a related issue (PersistenceUnitInfo.addTransformer() needs more work) and could be the cause of the "temporary classloader ... is not available" error. The error message looks very nice but I'm wondering if its theory as to the likely cause, is wrong. I have some ideas for fixing AS7-4996 , which could help your test also. Can we please continue this discussion in the AS7 forums. Thanks for continuing to push on EclipseLink integration and these issues! Much appreciated!
          Hide
          smarlow Scott Marlow added a comment -

          The JPA container side code is no longer in the EJB3 project, it is now part of the AS project (https://github.com/jbossas/jboss-as/tree/master/jpa). This issue is resolved in the JPA subsystem in AS7.

          Show
          smarlow Scott Marlow added a comment - The JPA container side code is no longer in the EJB3 project, it is now part of the AS project ( https://github.com/jbossas/jboss-as/tree/master/jpa ). This issue is resolved in the JPA subsystem in AS7.

            People

            • Assignee:
              smarlow Scott Marlow
              Reporter:
              epbernard Emmanuel Bernard
            • Votes:
              11 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development