Going through the eclipselink code.
Since I want to use spring, osgi and eclipselink.
- I was hoping to declare my datasource in the spring configuration file.
- Use one of the entitymanagerfactory wrappers from spring.
However,
LocalContainerEntityManagerFactoryBean
calls
PersistenceProvider.createContainerEntityManagerFactory
which isn't supported in an OSGI container...
So my other option is using the presistenceprovider and calling
.createEntityManagerFactory, however, AFAIK, I would need to flatten
my DS as properties to be able to pass them in. (I think that's
possible)
So... would it be possible to support
createContainerEntityManagerFactory in an osgi container? I don't
really understand the implications or why it's not currently supported
in osgi.
Cheers,
Eric G.
On Wed, Oct 15, 2008 at 3:51 PM, Eric Gulatee <eric.gulatee@xxxxxxxxx> wrote:
Tom,
I edited the manifest for org.eclipse.persistence.jpa-1.1-M2.jar
I added an import for javax.sql.
My error [see below] went away :)
I looked at the code, still not sure why that line in PersistenceUnitProcessor has anything to do with javax.sql.Datasource. I must be missing something. Anyhow.
[2008-10-15 15:40:06.860] server-dm-16 <SPDE0020E> Application context creation failure for bundle 'com.da.da-dao-eclipselink'.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactoryPrivate' defined in URL [bundleentry://87/
META-INF/spring/applicationContext-db-eclipselink.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefini
tionStoreException: Factory method [public javax.persistence.EntityManagerFactory org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerF
actory(java.lang.String,java.util.Map)] threw exception; nested exception is java.lang.NoClassDefFoundError: javax/sql/DataSource
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:444)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFacto
ry.java:903)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:817
)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplication
Context.java:276)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(Dependen
cyWaiterApplicationContextExecutor.java:145)
at com.springsource.server.kernel.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:82)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public javax.persistence.EntityManagerFactory org.eclipse.p
ersistence.jpa.PersistenceProvider.createEntityManagerFactory(java.lang.String,java.util.Map)] threw exception; nested exception is java.lang.NoClassD
efFoundError: javax/sql/DataSource
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:127)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:435)
... 19 more
Caused by: java.lang.NoClassDefFoundError: javax/sql/DataSource
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:361)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:314)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcessor.java:237)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initPersistenceUnits(JPAInitializer.java:146)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initialize(JPAInitializer.java:135)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:104)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:115)
... 20 more
On Wed, Oct 15, 2008 at 11:33 AM, Eric Gulatee <eric.gulatee@xxxxxxxxx> wrote:
Tom,
- SpringDM which uses equinox under the covers.
- Java 1.6 build 105 from SUN.
Well, correct me if I'm wrong (I may very well be, I'm green/wet behind the ears on OSGI), wouldn't the eclipselink jpa 1.1 bundle still need to import the javax.sql package even if it's part of the JDK?
[I get failures when building my own app using mvn-bnd-plugin and deploying if javax.sql wasn't import since I'm using a datasource]
Cheers,
Eric G.
On Wed, Oct 15, 2008 at 9:33 AM, Tom Ware <tom.ware@xxxxxxxxxx> wrote:
Hi Eric,
What JVM are you using? What OSGI framework are you using?
Our testing has mainly been on Sun JDK 1.5 and 1.6 VMs using Equinox. In that environment, we get the DataSource class from the VM itself.
-Tom
Eric Gulatee wrote:
Defect opened.
Thanks for the prompt response. And for correcting the verbiage.
I'm following the POC as a baseline for eclipselink + osgi, and I'm getting the following error when I create my own activator. (I'm trying with eclipselink 1.1-M2)
Caused by: java.lang.NoClassDefFoundError: javax/sql/DataSource
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:361)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:314)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcessor.java:237)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initPersistenceUnits(JPAInitializer.java:146)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initialize(JPAInitializer.java:135)
I don't see the import for javax.sql in the eclipselink jpa osgi 1.1-M2 bundle. I'm not sure if that's intentional or not. Or If I've done something wrong :)
Cheers,
Eric G.
On Tue, Oct 14, 2008 at 10:18 AM, Tom Ware <tom.ware@xxxxxxxxxx <mailto:tom.ware@xxxxxxxxxx>> wrote:
Hi Eric,
You are correct. At the moment, we are not including version
numbers of the packages we export. It would be a good idea to enter
a bugzilla issue to have this resolved.
I believe the reason we do not see a lot of traffic on the mailing
lists about this issue is that if you import the EclipseLink bundles
as bundles (rather than as packages) things should work. That may
provide a workaround for you.
-Tom
Eric Gulatee wrote:
All,
I'm currently having trouble deploying the osgi bundles with
spring on the spring dm server platform.
It seems to be due to the osgi manifests not containing version
information. It would seem spring has an optional import on
versions 1 through 2.
And since there isn't version info in the 1.1-M2 manifests, it's
failing to be imported. [What I've been told]
For anyone interested, here's the thread on springsource's forums.
http://forum.springframework.org/showthread.php?t=61456
Cheers,
Eric Gulatee.
------------------------------------------------------------------------
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
------------------------------------------------------------------------
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users