Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-1615

Calling the method createAndCloseDummyEMF() causes NullPointerException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • jpa-2.4.0
    • jpa-2.5.0
    • JPA
    • JPA: 2.4.0, EclipseLink: 2.6.3

    Description

      In the current version of JPAContainer the method call createAndCloseDummyEMF throws the following NullPointerException:

      [EL Warning]: 2016-09-20 14:59:39.373--ServerSession(1864482722)--Thread(Thread[Start Level: Equinox Container: 80090ef3-307f-0016-1904-9194b7ab7645,5,main])--java.lang.NullPointerException
      [EL Severe]: 2016-09-20 14:59:39.373--ServerSession(1864482722)--Thread(Thread[Start Level: Equinox Container: 80090ef3-307f-0016-1904-9194b7ab7645,5,main])--java.lang.NullPointerException
      at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:892)
      at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:964)
      at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:633)
      at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:560)
      at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2056)
      at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:570)
      at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:242)
      at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)
      at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeNoSelectCall(DatasourceCallQueryMechanism.java:271)
      at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeNoSelect(DatasourceCallQueryMechanism.java:251)
      at org.eclipse.persistence.queries.DataModifyQuery.executeDatabaseQuery(DataModifyQuery.java:85)
      at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:904)
      at org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:3271)
      at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1857)
      at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1839)
      at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1790)
      at org.eclipse.persistence.internal.sessions.AbstractSession.priviledgedExecuteNonSelectingCall(AbstractSession.java:5079)
      at org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition.createOnDatabase(DatabaseObjectDefinition.java:202)
      at org.eclipse.persistence.tools.schemaframework.SchemaManager.createObject(SchemaManager.java:223)
      at org.eclipse.persistence.tools.schemaframework.TableCreator.createTables(TableCreator.java:171)
      at org.eclipse.persistence.tools.schemaframework.TableCreator.createTables(TableCreator.java:148)
      at org.eclipse.persistence.tools.schemaframework.TableCreator.createTables(TableCreator.java:140)
      at org.eclipse.persistence.tools.schemaframework.SchemaManager.createDefaultTables(SchemaManager.java:1032)
      at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.generateDefaultTables(EntityManagerFactoryProvider.java:109)
      at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.writeDDLToDatabase(EntityManagerSetupImpl.java:4225)
      at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.writeDDL(EntityManagerSetupImpl.java:4153)
      at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.writeDDL(EntityManagerSetupImpl.java:4053)
      at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:777)
      at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:205)
      at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:183)
      at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getDatabaseSession(EntityManagerFactoryImpl.java:528)
      at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactoryImpl(PersistenceProvider.java:385)
      at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:313)
      at org.apache.aries.jpa.eclipselink.adapter.EclipseLinkPersistenceProvider.createContainerEntityManagerFactory(EclipseLinkPersistenceProvider.java:52)
      at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.createAndCloseDummyEMF(PersistenceProviderTracker.java:105)
      at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:85)
      at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
      at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
      at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
      at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
      at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
      at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
      at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
      at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:914)
      at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
      at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
      at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
      at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
      at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
      at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
      at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464)
      at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:482)
      at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:998)
      at org.apache.aries.jpa.eclipselink.adapter.Activator.handlePotentialEclipseLink(Activator.java:116)
      at org.apache.aries.jpa.eclipselink.adapter.Activator.start(Activator.java:72)
      at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
      at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
      at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
      at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:941)
      at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:318)
      at org.eclipse.osgi.container.Module.doStart(Module.java:571)
      at org.eclipse.osgi.container.Module.start(Module.java:439)
      at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
      at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)
      at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
      at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
      at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
      at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
      at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
      

      In the class DatabaseAccessor of EclipseLink the following code is called (line 1570):

      statement = nativeConnection.prepareStatement(call.getSQLString());
      

      The nativeConnection is return by the class DummyDataSource and is a dynamic proxy using DummyHandler as InvocationHandler. Because the method prepareStatement returns an instance of the type java.sql.PreparedStatement the method proxyClasses gets called. This method now returns null, because the type PreparedStatement is not covered by the if-clauses. The following call (line: 892)

      rowCount = ((PreparedStatement)statement).executeUpdate(); }}
      

      in the class DatabaseAccessor now results in a NullPointerExcpetion.

      Attachments

        Activity

          People

            cschneider Christian Schneider
            herr-herner Jens Offenbach
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: