On Tue, Jan 29, 2013 at 11:50 AM, Gonzalo Aguilar Delgado
<[email protected]> wrote:
> Hello all,
>
> I'm new to this forum so please  be patient.
>
> I was googling for about 2 weeks how to solve some problems I have with
> this project. Maybe someone here can throw some light into my dark.
>

Hi

Yes I totally agree OSGi bundles can be a library hell.

That is why there is an alternative FAB which I blogged about here
http://www.davsclaus.com/2012/08/osgi-deployment-made-easy-with-fab.html

We have users on Fuse ESB that uses Hibernate with FAB deployments and
dont have the OSGi hell.

An alternative some people have done as well, is to create one giant
uber JAR / bundle with all the Hibernate JARs and its dependencies.
And possible enable dynamic osgi imports and whatnot. But yeah its a
hell to manage...




>
> First.
>     Why do we have to repackage every library is not in the form of
> bundle?
>     It would be easier, more manageable, to wrap missing libraries (not
> in the form of a bundle) around a container that describes its contents.
> This way something like, say, apache.commons does not need to be
> unpacked and packed with a new manifiest. This method will break signing
> if any, but proposed one does not.
>
>
> Second.
>     This project (in this case OSGi-> Felix) is supposed to be created
> to resolve library mess. But I can only find references to peculiarities
> to the implementation of the class loaders that makes every old project
> incompatible without modifications. Say Hibernate. Do I have to use
> packages that only springsource Enterprise provides? This is a little
> pain because if the bundle is not there, is not anywhere.
>
>
> Third.
>     After fighting with dependencies for a long time. I repackaged
> hibernate, spring and friend into a new package. And found that nothing
> works together. I was smart enough to get spring 3.0.7-RELEASE that
> comes with karaf. But found following problem that I'm not able to
> solve:
>
>
> But the class org/hibernate/cfg/Configuration is packaged with the rest.
> And it must find it. Where is the problem?
>
> I tried package different versions of hibernate that is the thing that I
> can touch. Because Spring is too much to repackage it. So I have to
> stick with the two versions included in the container, 3.0.7-RELEASE and
> 3.1 whatever.
>
> Any help on how to make it work?
>
>
> I read everywhere: Switch to openJPA it does bundles and works better
> with OSGi. But I just have much built on hibernate and don't want to
> switch. I want to learn how to make every project work. Don't want to
> have to do a switch to another project everytime I have some missing
> package (bundle) that makes the project not to work on osgi.
>
> Thank you in advance.
> It will be a great project once this kind of problems are solved.  In
> effect cxf works great!
>
>
> -----------------------------------
>
> Exception in thread "SpringOsgiExtenderThread-4"
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'crmSessionFactoryBean' defined in URL
> [bundle://196.0:0/META-INF/spring/hibernate-spring-beans.xml]:
> Instantiation of bean failed; nested exception is
> org.springframework.beans.BeanInstantiationException: Could not
> instantiate bean class
> [org.springframework.orm.hibernate3.LocalSessionFactoryBean]:
> Constructor threw exception; nested exception is
> java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:964)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:910)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:484)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
>         at org.springframework.beans.factory.support.AbstractBeanFactory
> $1.getObject(AbstractBeanFactory.java:293)
>         at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
>         at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
>         at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
>         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(DependencyWaiterApplicationContextExecutor.java:132)
>         at java.lang.Thread.run(Thread.java:679)
> Caused by: org.springframework.beans.BeanInstantiationException: Could
> not instantiate bean class
> [org.springframework.orm.hibernate3.LocalSessionFactoryBean]:
> Constructor threw exception; nested exception is
> java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
>         at
> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
>         at
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:957)
>         ... 15 more
> Caused by: java.lang.NoClassDefFoundError:
> org/hibernate/cfg/Configuration
>         at
> org.springframework.orm.hibernate3.LocalSessionFactoryBean.<init>(LocalSessionFactoryBean.java:189)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
>         at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>         at
> java.lang.reflect.Constructor.newInstance(Constructor.java:532)
>         at
> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
>         ... 17 more
>
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to