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.

[1]http://repo.fusesource.com/nexus/content/repositories/releases/org/apache/servicemix/apache-servicemix/4.3.1-fuse-00-00/

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

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

FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org

Reply via email to