how to integrate Spring-dm with Hibernate

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

how to integrate Spring-dm with Hibernate

stream
Hi everyone.
I wanna use karaf to make my project, meanwhile i wanna integrate with hibernate too.
i've tried make it with this site
http://notehive.com/wp/2008/07/23/osgi-hibernate-spring-dm-sample/

but  could not work.

below is the error from karaf:

java.lang.NoClassDefFoundError: org/hibernate/MappingException
        at java.lang.Class.getDeclaredConstructors0(Native Method)[:1.6.0_24]
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)[:1.6.0_24]
        at java.lang.Class.getDeclaredConstructors(Class.java:1836)[:1.6.0_24]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:227)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:930)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:903)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)[123:org.springframework.context:3.0.5.RELEASE]
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[66:org.springframework.osgi.core:1.2.1]
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[66:org.springframework.osgi.core:1.2.1]
        at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[66:org.springframework.osgi.core:1.2.1]
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[66:org.springframework.osgi.core:1.2.1]
        at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[67:org.springframework.osgi.extender:1.2.1]
        at java.lang.Thread.run(Thread.java:662)[:1.6.0_24]
Caused by: java.lang.ClassNotFoundException: org.hibernate.MappingException not found by org.springframework.orm [128]
        at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787)
        at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
        at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_24]
        ... 20 more
Reply | Threaded
Open this post in threaded view
|

Re: how to integrate Spring-dm with Hibernate

Freeman-2
Hi,

With FUSE ESB(which is based on karaf)[1], you can find a jpa-osgi example, which configure spring-dm with hibernate, you may need take a look to get some inspiration.


Freeman
On 2011-3-17, at 下午4:52, stream wrote:

Hi everyone.
I wanna use karaf to make my project, meanwhile i wanna integrate with
hibernate too.
i've tried make it with this site
http://notehive.com/wp/2008/07/23/osgi-hibernate-spring-dm-sample/

but  could not work.

below is the error from karaf:

java.lang.NoClassDefFoundError: org/hibernate/MappingException
at java.lang.Class.getDeclaredConstructors0(Native Method)[:1.6.0_24]
at
java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)[:1.6.0_24]
at java.lang.Class.getDeclaredConstructors(Class.java:1836)[:1.6.0_24]
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:227)[121:org.springframework.beans:3.0.5.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:930)[121:org.springframework.beans:3.0.5.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:903)[121:org.springframework.beans:3.0.5.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)[121:org.springframework.beans:3.0.5.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)[121:org.springframework.beans:3.0.5.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)[121:org.springframework.beans:3.0.5.RELEASE]
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[121:org.springframework.beans:3.0.5.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)[121:org.springframework.beans:3.0.5.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)[121:org.springframework.beans:3.0.5.RELEASE]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)[121:org.springframework.beans:3.0.5.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)[123:org.springframework.context:3.0.5.RELEASE]
at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[66:org.springframework.osgi.core:1.2.1]
at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[66:org.springframework.osgi.core:1.2.1]
at
org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[66:org.springframework.osgi.core:1.2.1]
at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[66:org.springframework.osgi.core:1.2.1]
at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[67:org.springframework.osgi.extender:1.2.1]
at java.lang.Thread.run(Thread.java:662)[:1.6.0_24]
Caused by: java.lang.ClassNotFoundException: org.hibernate.MappingException
not found by org.springframework.orm [128]
at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787)
at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_24]
... 20 more


--
View this message in context: http://karaf.922171.n3.nabble.com/how-to-integrate-Spring-dm-with-Hibernate-tp2692712p2692712.html
Sent from the Karaf - User mailing list archive at Nabble.com.


-- 
Freeman Fang

------------------------


Reply | Threaded
Open this post in threaded view
|

Re: how to integrate Spring-dm with Hibernate

mikevan
In reply to this post by stream
stream wrote
Hi everyone.
I wanna use karaf to make my project, meanwhile i wanna integrate with hibernate too.
i've tried make it with this site
http://notehive.com/wp/2008/07/23/osgi-hibernate-spring-dm-sample/

but  could not work.

below is the error from karaf:

java.lang.NoClassDefFoundError: org/hibernate/MappingException
        at java.lang.Class.getDeclaredConstructors0(Native Method)[:1.6.0_24]
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)[:1.6.0_24]
        at java.lang.Class.getDeclaredConstructors(Class.java:1836)[:1.6.0_24]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:227)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:930)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:903)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)[121:org.springframework.beans:3.0.5.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)[123:org.springframework.context:3.0.5.RELEASE]
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[66:org.springframework.osgi.core:1.2.1]
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[66:org.springframework.osgi.core:1.2.1]
        at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[66:org.springframework.osgi.core:1.2.1]
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[66:org.springframework.osgi.core:1.2.1]
        at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[67:org.springframework.osgi.extender:1.2.1]
        at java.lang.Thread.run(Thread.java:662)[:1.6.0_24]
Caused by: java.lang.ClassNotFoundException: org.hibernate.MappingException not found by org.springframework.orm [128]
        at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787)
        at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
        at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_24]
        ... 20 more
Hey Stream, I wrote a blog article on this subject back when I was running a open-source group at Java.net. Check this out and let me know if you have any questions. http://weblogs.java.net/blog/fossesi/archive/2010/09/16/some-results-converting-large-standard-java-app-set-osgi-bundles-bet
Reply | Threaded
Open this post in threaded view
|

Re: how to integrate Spring-dm with Hibernate

Andreas Pieber
Hey Stream,

This one may also be of use:
http://iocanel.blogspot.com/2010/07/wicket-spring-3-jpa2-hibernate-osgi.html

On Thu, Mar 17, 2011 at 5:41 PM, karafman <[hidden email]> wrote:

>
> stream wrote:
>>
>> Hi everyone.
>> I wanna use karaf to make my project, meanwhile i wanna integrate with
>> hibernate too.
>> i've tried make it with this site
>> http://notehive.com/wp/2008/07/23/osgi-hibernate-spring-dm-sample/
>>
>> but  could not work.
>>
>> below is the error from karaf:
>>
>> java.lang.NoClassDefFoundError: org/hibernate/MappingException
>>       at java.lang.Class.getDeclaredConstructors0(Native Method)[:1.6.0_24]
>>       at
>> java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)[:1.6.0_24]
>>       at java.lang.Class.getDeclaredConstructors(Class.java:1836)[:1.6.0_24]
>>       at
>> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:227)[121:org.springframework.beans:3.0.5.RELEASE]
>>       at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:930)[121:org.springframework.beans:3.0.5.RELEASE]
>>       at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:903)[121:org.springframework.beans:3.0.5.RELEASE]
>>       at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)[121:org.springframework.beans:3.0.5.RELEASE]
>>       at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)[121:org.springframework.beans:3.0.5.RELEASE]
>>       at
>> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)[121:org.springframework.beans:3.0.5.RELEASE]
>>       at
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[121:org.springframework.beans:3.0.5.RELEASE]
>>       at
>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)[121:org.springframework.beans:3.0.5.RELEASE]
>>       at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)[121:org.springframework.beans:3.0.5.RELEASE]
>>       at
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)[121:org.springframework.beans:3.0.5.RELEASE]
>>       at
>> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)[123:org.springframework.context:3.0.5.RELEASE]
>>       at
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[66:org.springframework.osgi.core:1.2.1]
>>       at
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[66:org.springframework.osgi.core:1.2.1]
>>       at
>> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[66:org.springframework.osgi.core:1.2.1]
>>       at
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[66:org.springframework.osgi.core:1.2.1]
>>       at
>> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[67:org.springframework.osgi.extender:1.2.1]
>>       at java.lang.Thread.run(Thread.java:662)[:1.6.0_24]
>> Caused by: java.lang.ClassNotFoundException:
>> org.hibernate.MappingException not found by org.springframework.orm [128]
>>       at
>> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787)
>>       at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
>>       at
>> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
>>       at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_24]
>>       ... 20 more
>>
>
> Hey Stream, I wrote a blog article on this subject back when I was running a
> open-source group at Java.net. Check this out and let me know if you have
> any questions.
> http://weblogs.java.net/blog/fossesi/archive/2010/09/16/some-results-converting-large-standard-java-app-set-osgi-bundles-bet
>
> -----
> Karafman
> Slayer of the JEE
> Pounder of the Perl Programmer
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/how-to-integrate-Spring-dm-with-Hibernate-tp2692712p2694273.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: how to integrate Spring-dm with Hibernate

stream
In reply to this post by stream
Thanks all guys.

i will try all of your post  in turn.
if i got some result, i will put it here

thanks again.
Reply | Threaded
Open this post in threaded view
|

Re: how to integrate Spring-dm with Hibernate

iocanel
Hi stream,

I have spent some time on this problem and here are my tips:

  • If you are going to use jpa 2 which translates to hibernate version over 3.5, then you will have hard time finding a bundle (I would suggest you try this https://issues.apache.org/jira/browse/SMX4-715 its more recent that the one I made for my blog).
  • if you are going to use apache aries (which I recommend), then your hibernate bundle will need to register a javax.persistence.spi.PersistenceProvider service.
  • I haven't tried springsource hibernate bundles (which are for older version of hibernate) but they may worth trying.


On Fri, Mar 18, 2011 at 10:24 AM, stream <[hidden email]> wrote:
Thanks all guys.

i will try all of your post  in turn.
if i got some result, i will put it here

thanks again.

--
View this message in context: http://karaf.922171.n3.nabble.com/how-to-integrate-Spring-dm-with-Hibernate-tp2692712p2697176.html
Sent from the Karaf - User mailing list archive at Nabble.com.



--
Ioannis Canellos





Ioannis Canellos
http://iocanel.blogspot.com
Reply | Threaded
Open this post in threaded view
|

Re: how to integrate Spring-dm with Hibernate

seijoed
I'd strongly suggest you use Aries and Openjpa....

On Mar 18, 2011, at 9:25, Ioannis Canellos <[hidden email]> wrote:

Hi stream,

I have spent some time on this problem and here are my tips:

  • If you are going to use jpa 2 which translates to hibernate version over 3.5, then you will have hard time finding a bundle (I would suggest you try this https://issues.apache.org/jira/browse/SMX4-715 its more recent that the one I made for my blog).
  • if you are going to use apache aries (which I recommend), then your hibernate bundle will need to register a javax.persistence.spi.PersistenceProvider service.
  • I haven't tried springsource hibernate bundles (which are for older version of hibernate) but they may worth trying.


On Fri, Mar 18, 2011 at 10:24 AM, stream <[hidden email]> wrote:
Thanks all guys.

i will try all of your post  in turn.
if i got some result, i will put it here

thanks again.

--
View this message in context: http://karaf.922171.n3.nabble.com/how-to-integrate-Spring-dm-with-Hibernate-tp2692712p2697176.html
Sent from the Karaf - User mailing list archive at Nabble.com.



--
Ioannis Canellos