Community
Participate
Working Groups
Build Identifier: 1.0.0.M2-SNAPSHOT If eclipse.weaving is set to false, a NullPointerException subsequently occurs. java.lang.NullPointerException org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.findPersistenceArchives(PersistenceUnitProcessor.java:250) org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchives(JPAInitializer.java:138) org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfo(JPAInitializer.java:125) org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:98) This occurs because the instance of the GeminiOSGiInitializer.initializationClassLoader is null, and it's trying to execute: String descriptorPath = (String) m.get(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML); final Set<Archive> pars; if (descriptorPath != null) { pars = PersistenceUnitProcessor.findPersistenceArchives(initializationClassloader, descriptorPath); } else { pars = PersistenceUnitProcessor.findPersistenceArchives(initializationClassloader); } Whichever path occurs (FWIW mine found the META-INF/persistence.xml) the initializationClassLoader is null, which leads to an NPE on the next call: Enumeration<URL> resources = loader.getResources(descriptorPath); I believe this is marked as null because the eclipselink.weaving was set to 'false' in my persistence XML, which leads to the 'checkWeaving' call in GeminiOSgi's parent: if ((weaving != null) && ((weaving.equalsIgnoreCase("false")) || (weaving.equalsIgnoreCase("static")))){ shouldCreateInternalLoader = false; } As a result, the initializationClassLoader is null Reproducible: Always Steps to Reproduce: I believe this is triggered with an explicit instruction to disable weaving.
Hmm. I get the same error when I try eclipse.weaving=true in the persistence.xml.
BTW I'm using EclipseLink 2.1.1-jpa which exposes the problem. The property map 'm' contains the classloader so I wonder if it's a bug there using the initializationClassLoader instead of the supplied one?
Some other debugging inforamation that may be of use: 1) I'm calling 'EntityManagerFactory emf = Persistence .createEntityManagerFactory("jpa");' to trigger this 2) The OSGi console shows the service to be available: osgi> services (objectClass=javax.*) {javax.persistence.spi.PersistenceProvider}={javax.persistence.provider=org.eclipse.persistence.jpa. PersistenceProvider, osgi.jpa.provider.version=1.0.0.M2-incubation, service.id=103} Registered by bundle: org.eclipse.gemini.jpa_1.0.0.M2-incubation [77] No bundles using service. {javax.persistence.EntityManagerFactory}={osgi.managed.bundles=com.example, osgi.unit.version=1.0.0.SNAPSHOT, osgi.unit.name=jpa, osgi.unit.provider=org.eclipse.persistence.jpa.PersistenceProvider, service.id=109} Registered by bundle: com.example [84] Bundles using service: org.eclipse.gemini.javax.persistence_2.0.0.M2-incubation [25] 3) I'm running this in Virgo, and the bundles have been loaded as required with the PAR deployed containing the JPA bundle (above)
OK. As a further follow up to this, the acquisition of the service is succeeding, so I'm getting the entity manager factory, but it's falling at the createEntityManager() call.
Duplicate of 328072. Fixed in pending M3 drop. (Thanks for your work looking into it, though :-)
*** This bug has been marked as a duplicate of bug 328072 ***
Good to know. Any idea when the pending M3 drop is? I don't think there's a workaround around this, is there?