You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Shekh Muenudden <sh...@gmail.com> on 2016/04/13 08:52:39 UTC

Integrate hibernate in serviceM\ix

I have create simple soap webservice in servicemix.
and installed hibernate feature.

i got following error:
karaf@root>Exception in thread "SpringOsgiExtenderThread-6"
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'sessionFactory' de
fined in URL [bundle://234.46:0/META-INF/spring/spring-hibernate.xml]:
Initialization of bean failed; nested exception is
java.lang.NoClassDefFoundError: [Lorg/hibern
ate/engine/FilterDefinition;
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)
        at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)
        at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
        at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
        at
org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
        at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320
)
        at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicat
ionContextExecutor.java:132)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError:
[Lorg/hibernate/engine/FilterDefinition;
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
        at java.lang.Class.privateGetPublicMethods(Class.java:2902)
        at java.lang.Class.getMethods(Class.java:1615)
        at
org.springframework.beans.ExtendedBeanInfoFactory.supports(ExtendedBeanInfoFactory.java:53)
        at
org.springframework.beans.ExtendedBeanInfoFactory.getBeanInfo(ExtendedBeanInfoFactory.java:45)
        at
org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:270)
        at
org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:195)
        at
org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:321)
        at
org.springframework.beans.BeanWrapperImpl.getPropertyDescriptorInternal(BeanWrapperImpl.java:351)
        at
org.springframework.beans.BeanWrapperImpl.isWritableProperty(BeanWrapperImpl.java:428)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1421)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        ... 13 more
Caused by: java.lang.ClassNotFoundException:
org.hibernate.engine.FilterDefinition not found by org.hibernate.core [303]
        at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
        at
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
        at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at
org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1374)
        at
org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1553)
        at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1484)
        at
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
        at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 27 more



My hibernate bean configuration is :

  <bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

        

        <property name="hibernateProperties">
            <props>
                <prop
key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.format_sql">true</prop>
                <prop key="hibernate.hbm2ddl.auto">update</prop>
            </props>
        </property>
        <property name="dataSource">
            <ref bean="dataSource" />
        </property>
        
    </bean>



--
View this message in context: http://servicemix.396122.n5.nabble.com/Integrate-hibernate-in-serviceM-ix-tp5723593.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Integrate hibernate in serviceM\ix

Posted by Morgan Hautman <mo...@gmail.com>.
Hi again,

Which version of Servicemix are you using?

Regards,
Morgan

2016-04-14 14:56 GMT+02:00 Morgan Hautman <mo...@gmail.com>:

> Hi,
>
> Which hibernate version did you install with feature:install ?
>
> Regards,
> Morgan
>
> 2016-04-13 8:52 GMT+02:00 Shekh Muenudden <sh...@gmail.com>:
>
>> I have create simple soap webservice in servicemix.
>> and installed hibernate feature.
>>
>> i got following error:
>> karaf@root>Exception in thread "SpringOsgiExtenderThread-6"
>> org.springframework.beans.factory.BeanCreationException: Error creating
>> bean
>> with name 'sessionFactory' de
>> fined in URL [bundle://234.46:0/META-INF/spring/spring-hibernate.xml]:
>> Initialization of bean failed; nested exception is
>> java.lang.NoClassDefFoundError: [Lorg/hibern
>> ate/engine/FilterDefinition;
>>         at
>>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529)
>>         at
>>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
>>         at
>>
>> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
>>         at
>>
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
>>         at
>>
>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
>>         at
>>
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
>>         at
>>
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)
>>         at
>>
>> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)
>>         at
>>
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
>>         at
>>
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
>>         at
>>
>> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
>>         at
>>
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320
>> )
>>         at
>>
>> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicat
>> ionContextExecutor.java:132)
>>         at java.lang.Thread.run(Thread.java:745)
>> Caused by: java.lang.NoClassDefFoundError:
>> [Lorg/hibernate/engine/FilterDefinition;
>>         at java.lang.Class.getDeclaredMethods0(Native Method)
>>         at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
>>         at java.lang.Class.privateGetPublicMethods(Class.java:2902)
>>         at java.lang.Class.getMethods(Class.java:1615)
>>         at
>>
>> org.springframework.beans.ExtendedBeanInfoFactory.supports(ExtendedBeanInfoFactory.java:53)
>>         at
>>
>> org.springframework.beans.ExtendedBeanInfoFactory.getBeanInfo(ExtendedBeanInfoFactory.java:45)
>>         at
>>
>> org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:270)
>>         at
>>
>> org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:195)
>>         at
>>
>> org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:321)
>>         at
>>
>> org.springframework.beans.BeanWrapperImpl.getPropertyDescriptorInternal(BeanWrapperImpl.java:351)
>>         at
>>
>> org.springframework.beans.BeanWrapperImpl.isWritableProperty(BeanWrapperImpl.java:428)
>>         at
>>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1421)
>>         at
>>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
>>         at
>>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>>         ... 13 more
>> Caused by: java.lang.ClassNotFoundException:
>> org.hibernate.engine.FilterDefinition not found by org.hibernate.core
>> [303]
>>         at
>>
>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
>>         at
>>
>> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
>>         at
>>
>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>         at
>>
>> org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1374)
>>         at
>>
>> org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1553)
>>         at
>>
>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1484)
>>         at
>>
>> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
>>         at
>>
>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>         ... 27 more
>>
>>
>>
>> My hibernate bean configuration is :
>>
>>   <bean id="sessionFactory"
>> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
>>
>>
>>
>>         <property name="hibernateProperties">
>>             <props>
>>                 <prop
>> key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
>>                 <prop key="hibernate.show_sql">true</prop>
>>                 <prop key="hibernate.format_sql">true</prop>
>>                 <prop key="hibernate.hbm2ddl.auto">update</prop>
>>             </props>
>>         </property>
>>         <property name="dataSource">
>>             <ref bean="dataSource" />
>>         </property>
>>
>>     </bean>
>>
>>
>>
>> --
>> View this message in context:
>> http://servicemix.396122.n5.nabble.com/Integrate-hibernate-in-serviceM-ix-tp5723593.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>
>

Re: Integrate hibernate in serviceM\ix

Posted by Morgan Hautman <mo...@gmail.com>.
Hi,

Which hibernate version did you install with feature:install ?

Regards,
Morgan

2016-04-13 8:52 GMT+02:00 Shekh Muenudden <sh...@gmail.com>:

> I have create simple soap webservice in servicemix.
> and installed hibernate feature.
>
> i got following error:
> karaf@root>Exception in thread "SpringOsgiExtenderThread-6"
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean
> with name 'sessionFactory' de
> fined in URL [bundle://234.46:0/META-INF/spring/spring-hibernate.xml]:
> Initialization of bean failed; nested exception is
> java.lang.NoClassDefFoundError: [Lorg/hibern
> ate/engine/FilterDefinition;
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
>         at
>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
>         at
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)
>         at
>
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)
>         at
>
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
>         at
>
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
>         at
>
> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
>         at
>
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320
> )
>         at
>
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicat
> ionContextExecutor.java:132)
>         at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.NoClassDefFoundError:
> [Lorg/hibernate/engine/FilterDefinition;
>         at java.lang.Class.getDeclaredMethods0(Native Method)
>         at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
>         at java.lang.Class.privateGetPublicMethods(Class.java:2902)
>         at java.lang.Class.getMethods(Class.java:1615)
>         at
>
> org.springframework.beans.ExtendedBeanInfoFactory.supports(ExtendedBeanInfoFactory.java:53)
>         at
>
> org.springframework.beans.ExtendedBeanInfoFactory.getBeanInfo(ExtendedBeanInfoFactory.java:45)
>         at
>
> org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:270)
>         at
>
> org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:195)
>         at
>
> org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:321)
>         at
>
> org.springframework.beans.BeanWrapperImpl.getPropertyDescriptorInternal(BeanWrapperImpl.java:351)
>         at
>
> org.springframework.beans.BeanWrapperImpl.isWritableProperty(BeanWrapperImpl.java:428)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1421)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>         ... 13 more
> Caused by: java.lang.ClassNotFoundException:
> org.hibernate.engine.FilterDefinition not found by org.hibernate.core [303]
>         at
>
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
>         at
>
> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
>         at
>
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>         at
>
> org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1374)
>         at
>
> org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1553)
>         at
>
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1484)
>         at
>
> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
>         at
>
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>         ... 27 more
>
>
>
> My hibernate bean configuration is :
>
>   <bean id="sessionFactory"
> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
>
>
>
>         <property name="hibernateProperties">
>             <props>
>                 <prop
> key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
>                 <prop key="hibernate.show_sql">true</prop>
>                 <prop key="hibernate.format_sql">true</prop>
>                 <prop key="hibernate.hbm2ddl.auto">update</prop>
>             </props>
>         </property>
>         <property name="dataSource">
>             <ref bean="dataSource" />
>         </property>
>
>     </bean>
>
>
>
> --
> View this message in context:
> http://servicemix.396122.n5.nabble.com/Integrate-hibernate-in-serviceM-ix-tp5723593.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>

Re: Integrate hibernate in serviceM\ix

Posted by Christian Schneider <ch...@die-schneider.net>.
What I said is that you can not do it the same way as outside OSGi. Not 
that it is impossible.

Christian

On 15.04.2016 14:02, Morgan Hautman wrote:
> Hi Christian,
>
> Sorry but I think you're wrong here.
> It is possible to deploy non-osgi applications on Karaf so I don't get your
> point actually (it may be harder depending on the way you do it, there we
> agree)
>
> I think the problem of Skekh relies on the fact he installed the wrong
> feature version which depends on Hibernate 4 and not Hibernate 3 like
> stated in his code sample.
>
> Regards,
> Morgan
>
> 2016-04-14 14:45 GMT+02:00 Christian Schneider <ch...@die-schneider.net>:
>
>> You can not simply work with hibernate like outside OSGi. If you try then
>> you will hist classloader problems at many points.
>>
>> I got two examples that show how to do JPA in OSGi:
>>
>> http://www.liquid-reality.de/display/liquid/2015/06/30/Apache+Karaf+Tutorial+part+10+-+Declarative+services
>>
>> http://www.liquid-reality.de/display/liquid/2015/03/05/Apache+Karaf+Tutorial+Part+9+-+Annotation+based+blueprint+and+JPA
>>
>> The examples use blueprint or DS. Unfortunately I have no example with
>> spring.
>>
>> Christian
>>
>>
>> On 13.04.2016 08:52, Shekh Muenudden wrote:
>>
>>> I have create simple soap webservice in servicemix.
>>> and installed hibernate feature.
>>>
>>> i got following error:
>>> karaf@root>Exception in thread "SpringOsgiExtenderThread-6"
>>> org.springframework.beans.factory.BeanCreationException: Error creating
>>> bean
>>> with name 'sessionFactory' de
>>> fined in URL [bundle://234.46:0/META-INF/spring/spring-hibernate.xml]:
>>> Initialization of bean failed; nested exception is
>>> java.lang.NoClassDefFoundError: [Lorg/hibern
>>> ate/engine/FilterDefinition;
>>>           at
>>>
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529)
>>>           at
>>>
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
>>>           at
>>>
>>> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
>>>           at
>>>
>>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
>>>           at
>>>
>>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
>>>           at
>>>
>>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
>>>           at
>>>
>>> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)
>>>           at
>>>
>>> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)
>>>           at
>>>
>>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
>>>           at
>>>
>>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
>>>           at
>>>
>>> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
>>>           at
>>>
>>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320
>>> )
>>>           at
>>>
>>> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicat
>>> ionContextExecutor.java:132)
>>>           at java.lang.Thread.run(Thread.java:745)
>>> Caused by: java.lang.NoClassDefFoundError:
>>> [Lorg/hibernate/engine/FilterDefinition;
>>>           at java.lang.Class.getDeclaredMethods0(Native Method)
>>>           at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
>>>           at java.lang.Class.privateGetPublicMethods(Class.java:2902)
>>>           at java.lang.Class.getMethods(Class.java:1615)
>>>           at
>>>
>>> org.springframework.beans.ExtendedBeanInfoFactory.supports(ExtendedBeanInfoFactory.java:53)
>>>           at
>>>
>>> org.springframework.beans.ExtendedBeanInfoFactory.getBeanInfo(ExtendedBeanInfoFactory.java:45)
>>>           at
>>>
>>> org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:270)
>>>           at
>>>
>>> org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:195)
>>>           at
>>>
>>> org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:321)
>>>           at
>>>
>>> org.springframework.beans.BeanWrapperImpl.getPropertyDescriptorInternal(BeanWrapperImpl.java:351)
>>>           at
>>>
>>> org.springframework.beans.BeanWrapperImpl.isWritableProperty(BeanWrapperImpl.java:428)
>>>           at
>>>
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1421)
>>>           at
>>>
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
>>>           at
>>>
>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>>>           ... 13 more
>>> Caused by: java.lang.ClassNotFoundException:
>>> org.hibernate.engine.FilterDefinition not found by org.hibernate.core
>>> [303]
>>>           at
>>>
>>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
>>>           at
>>>
>>> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
>>>           at
>>>
>>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
>>>           at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>>           at
>>>
>>> org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1374)
>>>           at
>>>
>>> org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1553)
>>>           at
>>>
>>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1484)
>>>           at
>>>
>>> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
>>>           at
>>>
>>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
>>>           at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>>           ... 27 more
>>>
>>>
>>>
>>> My hibernate bean configuration is :
>>>
>>>     <bean id="sessionFactory"
>>> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
>>>
>>>
>>>           <property name="hibernateProperties">
>>>               <props>
>>>                   <prop
>>> key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
>>>                   <prop key="hibernate.show_sql">true</prop>
>>>                   <prop key="hibernate.format_sql">true</prop>
>>>                   <prop key="hibernate.hbm2ddl.auto">update</prop>
>>>               </props>
>>>           </property>
>>>           <property name="dataSource">
>>>               <ref bean="dataSource" />
>>>           </property>
>>>                </bean>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://servicemix.396122.n5.nabble.com/Integrate-hibernate-in-serviceM-ix-tp5723593.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>
>> --
>> Christian Schneider
>> http://www.liquid-reality.de
>>
>> Open Source Architect
>> http://www.talend.com
>>
>>


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Re: Integrate hibernate in serviceM\ix

Posted by Morgan Hautman <mo...@gmail.com>.
Hi Christian,

Sorry but I think you're wrong here.
It is possible to deploy non-osgi applications on Karaf so I don't get your
point actually (it may be harder depending on the way you do it, there we
agree)

I think the problem of Skekh relies on the fact he installed the wrong
feature version which depends on Hibernate 4 and not Hibernate 3 like
stated in his code sample.

Regards,
Morgan

2016-04-14 14:45 GMT+02:00 Christian Schneider <ch...@die-schneider.net>:

> You can not simply work with hibernate like outside OSGi. If you try then
> you will hist classloader problems at many points.
>
> I got two examples that show how to do JPA in OSGi:
>
> http://www.liquid-reality.de/display/liquid/2015/06/30/Apache+Karaf+Tutorial+part+10+-+Declarative+services
>
> http://www.liquid-reality.de/display/liquid/2015/03/05/Apache+Karaf+Tutorial+Part+9+-+Annotation+based+blueprint+and+JPA
>
> The examples use blueprint or DS. Unfortunately I have no example with
> spring.
>
> Christian
>
>
> On 13.04.2016 08:52, Shekh Muenudden wrote:
>
>> I have create simple soap webservice in servicemix.
>> and installed hibernate feature.
>>
>> i got following error:
>> karaf@root>Exception in thread "SpringOsgiExtenderThread-6"
>> org.springframework.beans.factory.BeanCreationException: Error creating
>> bean
>> with name 'sessionFactory' de
>> fined in URL [bundle://234.46:0/META-INF/spring/spring-hibernate.xml]:
>> Initialization of bean failed; nested exception is
>> java.lang.NoClassDefFoundError: [Lorg/hibern
>> ate/engine/FilterDefinition;
>>          at
>>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529)
>>          at
>>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
>>          at
>>
>> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
>>          at
>>
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
>>          at
>>
>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
>>          at
>>
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
>>          at
>>
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)
>>          at
>>
>> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)
>>          at
>>
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
>>          at
>>
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
>>          at
>>
>> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
>>          at
>>
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320
>> )
>>          at
>>
>> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicat
>> ionContextExecutor.java:132)
>>          at java.lang.Thread.run(Thread.java:745)
>> Caused by: java.lang.NoClassDefFoundError:
>> [Lorg/hibernate/engine/FilterDefinition;
>>          at java.lang.Class.getDeclaredMethods0(Native Method)
>>          at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
>>          at java.lang.Class.privateGetPublicMethods(Class.java:2902)
>>          at java.lang.Class.getMethods(Class.java:1615)
>>          at
>>
>> org.springframework.beans.ExtendedBeanInfoFactory.supports(ExtendedBeanInfoFactory.java:53)
>>          at
>>
>> org.springframework.beans.ExtendedBeanInfoFactory.getBeanInfo(ExtendedBeanInfoFactory.java:45)
>>          at
>>
>> org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:270)
>>          at
>>
>> org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:195)
>>          at
>>
>> org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:321)
>>          at
>>
>> org.springframework.beans.BeanWrapperImpl.getPropertyDescriptorInternal(BeanWrapperImpl.java:351)
>>          at
>>
>> org.springframework.beans.BeanWrapperImpl.isWritableProperty(BeanWrapperImpl.java:428)
>>          at
>>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1421)
>>          at
>>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
>>          at
>>
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>>          ... 13 more
>> Caused by: java.lang.ClassNotFoundException:
>> org.hibernate.engine.FilterDefinition not found by org.hibernate.core
>> [303]
>>          at
>>
>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
>>          at
>>
>> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
>>          at
>>
>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
>>          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>          at
>>
>> org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1374)
>>          at
>>
>> org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1553)
>>          at
>>
>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1484)
>>          at
>>
>> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
>>          at
>>
>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
>>          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>          ... 27 more
>>
>>
>>
>> My hibernate bean configuration is :
>>
>>    <bean id="sessionFactory"
>> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
>>
>>
>>          <property name="hibernateProperties">
>>              <props>
>>                  <prop
>> key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
>>                  <prop key="hibernate.show_sql">true</prop>
>>                  <prop key="hibernate.format_sql">true</prop>
>>                  <prop key="hibernate.hbm2ddl.auto">update</prop>
>>              </props>
>>          </property>
>>          <property name="dataSource">
>>              <ref bean="dataSource" />
>>          </property>
>>               </bean>
>>
>>
>>
>> --
>> View this message in context:
>> http://servicemix.396122.n5.nabble.com/Integrate-hibernate-in-serviceM-ix-tp5723593.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> http://www.talend.com
>
>

Re: Integrate hibernate in serviceM\ix

Posted by Christian Schneider <ch...@die-schneider.net>.
You can not simply work with hibernate like outside OSGi. If you try 
then you will hist classloader problems at many points.

I got two examples that show how to do JPA in OSGi:
http://www.liquid-reality.de/display/liquid/2015/06/30/Apache+Karaf+Tutorial+part+10+-+Declarative+services
http://www.liquid-reality.de/display/liquid/2015/03/05/Apache+Karaf+Tutorial+Part+9+-+Annotation+based+blueprint+and+JPA

The examples use blueprint or DS. Unfortunately I have no example with 
spring.

Christian

On 13.04.2016 08:52, Shekh Muenudden wrote:
> I have create simple soap webservice in servicemix.
> and installed hibernate feature.
>
> i got following error:
> karaf@root>Exception in thread "SpringOsgiExtenderThread-6"
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'sessionFactory' de
> fined in URL [bundle://234.46:0/META-INF/spring/spring-hibernate.xml]:
> Initialization of bean failed; nested exception is
> java.lang.NoClassDefFoundError: [Lorg/hibern
> ate/engine/FilterDefinition;
>          at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529)
>          at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
>          at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
>          at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
>          at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
>          at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
>          at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)
>          at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)
>          at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
>          at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
>          at
> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
>          at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320
> )
>          at
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicat
> ionContextExecutor.java:132)
>          at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.NoClassDefFoundError:
> [Lorg/hibernate/engine/FilterDefinition;
>          at java.lang.Class.getDeclaredMethods0(Native Method)
>          at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
>          at java.lang.Class.privateGetPublicMethods(Class.java:2902)
>          at java.lang.Class.getMethods(Class.java:1615)
>          at
> org.springframework.beans.ExtendedBeanInfoFactory.supports(ExtendedBeanInfoFactory.java:53)
>          at
> org.springframework.beans.ExtendedBeanInfoFactory.getBeanInfo(ExtendedBeanInfoFactory.java:45)
>          at
> org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:270)
>          at
> org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:195)
>          at
> org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:321)
>          at
> org.springframework.beans.BeanWrapperImpl.getPropertyDescriptorInternal(BeanWrapperImpl.java:351)
>          at
> org.springframework.beans.BeanWrapperImpl.isWritableProperty(BeanWrapperImpl.java:428)
>          at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1421)
>          at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
>          at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>          ... 13 more
> Caused by: java.lang.ClassNotFoundException:
> org.hibernate.engine.FilterDefinition not found by org.hibernate.core [303]
>          at
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
>          at
> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
>          at
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
>          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>          at
> org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1374)
>          at
> org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1553)
>          at
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1484)
>          at
> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
>          at
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
>          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>          ... 27 more
>
>
>
> My hibernate bean configuration is :
>
>    <bean id="sessionFactory"
> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
>
>          
>
>          <property name="hibernateProperties">
>              <props>
>                  <prop
> key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
>                  <prop key="hibernate.show_sql">true</prop>
>                  <prop key="hibernate.format_sql">true</prop>
>                  <prop key="hibernate.hbm2ddl.auto">update</prop>
>              </props>
>          </property>
>          <property name="dataSource">
>              <ref bean="dataSource" />
>          </property>
>          
>      </bean>
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Integrate-hibernate-in-serviceM-ix-tp5723593.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com