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...
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
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)