Announcement Announcement Module
Collapse
No announcement yet.
Destroyed OSGI Referenced Datasource Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Destroyed OSGI Referenced Datasource

    Hi All,

    I am currently doing an osgi:reference to a datasource defined in another package. I am getting an "Original must not be null", now upon enabling more debugging, I am noticing that prior to the datasource being injected in the entitymanagerfactory. It is being destroyed!

    I have attached the spring context as well as the trace file.

    I'm confused as to why the datasource is being destroyed prior to being injected...

    Cheers,
    Eric G.

  • #2
    Note:

    I did convert from using LocalContainerEntityManagerFactoryBean due to eclipselink throwing the following exception which seems to indicate createContainer not supported in OSGI.


    Caused by: java.lang.NullPointerException
    at org.eclipse.persistence.exceptions.i18n.ExceptionM essageGenerator.buildMessage(ExceptionMessageGener ator.java:41)
    at org.eclipse.persistence.exceptions.EntityManagerSe tupException.createContainerEntityManagerFactoryNo tSupportedInOSGi(EntityManagerSetupException.java: 284)
    at org.eclipse.persistence.jpa.osgi.PersistenceProvid er.createContainerEntityManagerFactory(Persistence Provider.java:42)
    at org.springframework.orm.jpa.LocalContainerEntityMa nagerFactoryBean.createNativeEntityManagerFactory( LocalContainerEntityManagerFactoryBean.java:224)
    at org.springframework.orm.jpa.AbstractEntityManagerF actoryBean.afterPropertiesSet(AbstractEntityManage rFactoryBean.java:291)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1368)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1334)
    ... 17 more

    Comment


    • #3
      So then I changed direction and looked at the eclipselink samples.

      Instantiating the entitymanagerfactory via the persistence provider. And ran into the problem I reported on the eclipselink forums.

      Caused by: java.lang.NoClassDefFoundError: javax/sql/DataSource
      at org.eclipse.persistence.internal.jpa.deployment.Pe rsistenceUnitProcessor.processPersistenceXML(Persi stenceUnitProcessor.java:361)
      at org.eclipse.persistence.internal.jpa.deployment.Pe rsistenceUnitProcessor.processPersistenceArchive(P ersistenceUnitProcessor.java:314)
      at org.eclipse.persistence.internal.jpa.deployment.Pe rsistenceUnitProcessor.getPersistenceUnits(Persist enceUnitProcessor.java:237)
      at org.eclipse.persistence.internal.jpa.deployment.JP AInitializer.initPersistenceUnits(JPAInitializer.j ava:146)
      at org.eclipse.persistence.internal.jpa.deployment.JP AInitializer.initialize(JPAInitializer.java:135)
      at org.eclipse.persistence.jpa.PersistenceProvider.cr eateEntityManagerFactory(PersistenceProvider.java: 104)
      at org.eclipse.persistence.jpa.PersistenceProvider.cr eateEntityManagerFactory(PersistenceProvider.java: 64)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)



      <bean id="eclipseLinkJPAProperties"
      class="org.springframework.beans.factory.config.Pr opertiesFactoryBean">
      <property name="properties">
      <props>
      <prop key="eclipselink.logging.exceptions">true</prop>
      <prop key="eclipselink.ddl-generation">create-tables</prop>
      <prop key="eclipselink.ddl-generation.output-mode">both</prop>
      <prop key="eclipselink.target-database">
      org.eclipse.persistence.platform.database.DerbyPla tform</prop>
      <prop key="eclipselink.drop-ddl-jdbc-file-name">drop.sql</prop>
      <prop key="eclipselink.create-ddl-jdbc-file-name">create.sql</prop>
      </props>
      </property>
      </bean>

      <bean id="persistenceprovider" class="org.eclipse.persistence.jpa.osgi.Persistenc eProvider">
      </bean>

      <bean id="jpaAdapter"
      class="org.springframework.orm.jpa.vendor.EclipseL inkJpaVendorAdapter">
      <property name="databasePlatform" value="org.eclipse.persistence.platform.database.D erbyPlatform"></property>
      <property name="generateDdl" value="true"></property>
      </bean>
      <bean id="jpaDialect"
      class="org.springframework.orm.jpa.vendor.EclipseL inkJpaDialect">
      </bean>

      <bean id="entityManagerFactoryPrivate" factory-bean="persistenceprovider" factory-method="createEntityManagerFactory">
      <constructor-arg value="TestJPA"></constructor-arg>
      <constructor-arg ref="eclipseLinkJPAProperties"></constructor-arg>
      </bean>

      Comment


      • #4
        Editing the manifest for eclipselink solved the problem.

        I opened a defect on the eclipselink bugzilla.

        Spring, OSGI, EclipseLink integration is quite a complicated beast to tackle.

        Comment

        Working...
        X