Exceptions using jpa-hibernate and cxf
--------------------------------------

                 Key: SMX4-657
                 URL: https://issues.apache.org/activemq/browse/SMX4-657
             Project: ServiceMix 4
          Issue Type: Bug
    Affects Versions: 4.2.0
            Reporter: Sergey Zhemzhitsky
            Priority: Critical


This issue is connected with http://fusesource.com/issues/browse/ESB-1177.

Steps to reproduce:
1. Start servicemix
2. Install jpa-hibernate feature by means of features:install jpa-hibernate
3. Refresh spring beans bundle
4. Exception occurs

It seems that the problem is in the cglib because: 

1. spring beans bundle optionally requires cglib: 
net.sf.cglib.proxy;version="[2.1.3, 3.0.0)";resolution:="optional"

Here is cglib imports of the spring bundle before installing jpa-hibernate and 
refreshing spring beans bundle

ka...@root> osgi:list | grep -i "spring beans"
[  60] [Active     ] [            ] [       ] [   60] Spring Beans 
(3.0.3.RELEASE)
ka...@root> packages:imports 60 | grep -i cglib
Apache ServiceMix :: Bundles :: cglib (70): net.sf.cglib.proxy; version="2.1.3"

2. install feature jpa-hibernate that requires cglib: 
net.sf.cglib.beans;version="[2.2.0, 3.0.0)",net.sf.cglib.core;version="[2.2.0, 
3.0.0)",net.sf.cglib.proxy;version="[2.2.0, 
3.0.0)",net.sf.cglib.reflect;version="[2.2.0, 
3.0.0)",net.sf.cglib.transform;version="[2.2.0, 
3.0.0)",net.sf.cglib.transform.impl;version="[2.2.0, 3.0.0)": features:install 
jpa-hibernate

3. refresh spring beans bundle: 

ka...@root> osgi:list | grep -i "spring beans"
[  60] [Active     ] [            ] [       ] [   60] Spring Beans 
(3.0.3.RELEASE)
ka...@root> osgi:refresh 60

4. Now spring beans bundle uses cglib 2.2.0 instead of 2.1.3:

ka...@root> osgi:list | grep -i "spring beans"
[  60] [Active     ] [            ] [       ] [   60] Spring Beans 
(3.0.3.RELEASE)
ka...@root> packages:imports 60 | grep -i cglib
CGLIB Code Generation Library (185): net.sf.cglib.proxy; version="2.2.0"

5. CXF optionally requires cglib: 
net.sf.cglib.proxy;resolution:=optional;version="[2.1.3,2.2.0)"

ka...@root> osgi:list | grep -i cxf
[ 138] [Active     ] [            ] [Started] [   60] Apache CXF Bundle Jar 
(2.2.10.fuse-00-00)
[ 140] [Active     ] [Created     ] [       ] [   60] Apache ServiceMix :: 
Components :: CXF Binding Component (2010.02.0.fuse-01-00)
[ 152] [Active     ] [            ] [       ] [   60] Apache CXF Runtime JBI 
Binding (2.2.10.fuse-00-00)
[ 153] [Active     ] [            ] [       ] [   60] Apache CXF Runtime JBI 
Transport (2.2.10.fuse-00-00)
[ 154] [Active     ] [            ] [Failed ] [   60] Apache ServiceMix :: 
Components :: CXF Service Engine (2010.02.0.fuse-01-00)

ka...@root> packages:imports 138 | grep -i cglib
Apache ServiceMix :: Bundles :: cglib (70): net.sf.cglib.proxy; version="2.1.3"

6. CXF optionally requires spring beans: 
org.springframework.beans;resolution:=optional;version="[2.5,4)"

ka...@root> osgi:list | grep -i cxf
[ 138] [Active     ] [            ] [Started] [   60] Apache CXF Bundle Jar 
(2.2.10.fuse-00-00)
[ 140] [Active     ] [Created     ] [       ] [   60] Apache ServiceMix :: 
Components :: CXF Binding Component (2010.02.0.fuse-01-00)
[ 152] [Active     ] [            ] [       ] [   60] Apache CXF Runtime JBI 
Binding (2.2.10.fuse-00-00)
[ 153] [Active     ] [            ] [       ] [   60] Apache CXF Runtime JBI 
Transport (2.2.10.fuse-00-00)
[ 154] [Active     ] [            ] [Failed ] [   60] Apache ServiceMix :: 
Components :: CXF Service Engine (2010.02.0.fuse-01-00)

ka...@root> packages:imports 138 | grep -i "spring beans"
Spring Beans (60): org.springframework.beans; version="3.0.3.RELEASE"
Spring Beans (60): org.springframework.beans.factory; version="3.0.3.RELEASE"
Spring Beans (60): org.springframework.beans.factory.annotation; 
version="3.0.3.RELEASE"
Spring Beans (60): org.springframework.beans.factory.config; 
version="3.0.3.RELEASE"
Spring Beans (60): org.springframework.beans.factory.wiring; 
version="3.0.3.RELEASE"
Spring Beans (60): org.springframework.beans.factory.xml; 
version="3.0.3.RELEASE"

Therefore, after installing jpa-hibernate and refreshing spring beans actual 
version of imported packages are:
spring beans: cglib 2.2.0
hibernate: cglib 2.2.0
cxf: spring beans 3.0.3.RELEASE
cxf: cglib 2.1.3

So cxf cannot use spring beans anymore.

To fix this problem try to import the same version of cglib into cxf: 
net.sf.cglib.proxy;resolution:=optional;version="[2.1.3,3.0)".

Stacktrace:
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'org.apache.cxf.binding.BindingFactoryManager' defined in OSGi 
resource[classpath:META-INF/cxf/cxf.xml|bnd.id=154|bnd.sym=servicemix-cxf-se]: 
Cannot create inner bean 
'org.apache.cxf.configuration.spring.SpringBeanMap#133da0' of type 
[org.apache.cxf.configuration.spring.SpringBeanMap] while setting bean property 
'mapProvider'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'org.apache.cxf.configuration.spring.SpringBeanMap#133da0' defined in 
OSGi 
resource[classpath:META-INF/cxf/cxf.xml|bnd.id=154|bnd.sym=servicemix-cxf-se]: 
Invocation of init method failed; nested exception is 
java.lang.NoClassDefFoundError: 
org/springframework/beans/factory/support/ManagedSet
        at 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)[60:org.springframework.beans:3.0.3.RELEASE]
        at 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)[60:org.springframework.beans:3.0.3.RELEASE]
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1317)[60:org.springframework.beans:3.0.3.RELEASE]
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076)[60:org.springframework.beans:3.0.3.RELEASE]
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)[60:org.springframework.beans:3.0.3.RELEASE]
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)[60:org.springframework.beans:3.0.3.RELEASE]
        at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)[60:org.springframework.beans:3.0.3.RELEASE]
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[60:org.springframework.beans:3.0.3.RELEASE]
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)[60:org.springframework.beans:3.0.3.RELEASE]
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)[60:org.springframework.beans:3.0.3.RELEASE]
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)[60:org.springframework.beans:3.0.3.RELEASE]
        at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)[62:org.springframework.context:3.0.3.RELEASE]
        at 
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[72:org.springframework.osgi.core:1.2.0]
        at 
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[72:org.springframework.osgi.core:1.2.0]
        at 
org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[72:org.springframework.osgi.core:1.2.0]
        at 
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[72:org.springframework.osgi.core:1.2.0]
        at 
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)[73:org.springframework.osgi.extender:1.2.0]
        at java.lang.Thread.run(Thread.java:619)[:1.6.0_21]
Caused by: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 
'org.apache.cxf.configuration.spring.SpringBeanMap#133da0' defined in OSGi 
resource[classpath:META-INF/cxf/cxf.xml|bnd.id=154|bnd.sym=servicemix-cxf-se]: 
Invocation of init method failed; nested exception is 
java.lang.NoClassDefFoundError: 
org/springframework/beans/factory/support/ManagedSet
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)[60:org.springframework.beans:3.0.3.RELEASE]
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)[60:org.springframework.beans:3.0.3.RELEASE]
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)[60:org.springframework.beans:3.0.3.RELEASE]
        at 
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270)[60:org.springframework.beans:3.0.3.RELEASE]
        ... 17 more
Caused by: java.lang.NoClassDefFoundError: 
org/springframework/beans/factory/support/ManagedSet
        at 
org.apache.cxf.configuration.spring.SpringBeanMap.processBeans(SpringBeanMap.java:83)
        at 
org.apache.cxf.configuration.spring.AbstractSpringBeanMap.afterPropertiesSet(AbstractSpringBeanMap.java:55)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)[60:org.springframework.beans:3.0.3.RELEASE]
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)[60:org.springframework.beans:3.0.3.RELEASE]
        ... 20 more
Caused by: java.lang.ClassNotFoundException: 
org.springframework.beans.factory.support.ManagedSet
        at 
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)[osgi-3.6.0.v20100517.jar:]
        at 
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)[osgi-3.6.0.v20100517.jar:]
        at 
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)[osgi-3.6.0.v20100517.jar:]
        at 
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)[osgi-3.6.0.v20100517.jar:]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_21]
        ... 24 more
10:49:00,879 | ERROR | rint Extender: 1 | BlueprintContainerImpl           | 
container.BlueprintContainerImpl  342 | 7 - org.apache.aries.blueprint - 
0.2.0.incubating | Unable to start blueprint container for bundle 
org.apache.servicemix.jbi.osgi
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to 
intialize bean componentWrapperTracker
        at 
org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:635)[7:org.apache.aries.blueprint:0.2.0.incubating]
        at 
org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:744)[7:org.apache.aries.blueprint:0.2.0.incubating]
        at 
org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)[7:org.apache.aries.blueprint:0.2.0.incubating]
        at 
org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)[7:org.apache.aries.blueprint:0.2.0.incubating]
        at 
org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:147)[7:org.apache.aries.blueprint:0.2.0.incubating]
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:624)[7:org.apache.aries.blueprint:0.2.0.incubating]
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:315)[7:org.apache.aries.blueprint:0.2.0.incubating]
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:213)[7:org.apache.aries.blueprint:0.2.0.incubating]
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_21]
        at 
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_21]
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_21]
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)[:1.6.0_21]
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)[:1.6.0_21]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_21]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_21]
        at java.lang.Thread.run(Thread.java:619)[:1.6.0_21]
Caused by: java.lang.NoClassDefFoundError: 
org/springframework/beans/factory/support/BeanDefinitionRegistry
        at 
org.apache.cxf.bus.spring.SpringBusFactory.createApplicationContext(SpringBusFactory.java:102)
        at 
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:93)
        at 
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:86)
        at 
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:64)
        at 
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:53)
        at 
org.apache.servicemix.cxfbc.CxfBcComponent.doInit(CxfBcComponent.java:82)
        at 
org.apache.servicemix.common.AsyncBaseLifeCycle.init(AsyncBaseLifeCycle.java:203)
        at 
org.apache.servicemix.jbi.deployer.artifacts.ComponentImpl$ComponentWrapper.init(ComponentImpl.java:247)
        at 
org.apache.servicemix.jbi.runtime.impl.ComponentRegistryImpl.doRegister(ComponentRegistryImpl.java:89)
        at 
org.apache.servicemix.jbi.runtime.impl.ComponentRegistryImpl.doRegister(ComponentRegistryImpl.java:38)
        at 
org.apache.servicemix.nmr.core.ServiceRegistryImpl.register(ServiceRegistryImpl.java:47)
        at 
org.apache.servicemix.nmr.osgi.OsgiServiceRegistryTracker.addingService(OsgiServiceRegistryTracker.java:78)
        at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)[osgi-3.6.0.v20100517.jar:]
        at 
org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)[osgi-3.6.0.v20100517.jar:]
        at 
org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:184)[osgi-3.6.0.v20100517.jar:]
        at 
org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:339)[osgi-3.6.0.v20100517.jar:]
        at 
org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:273)[osgi-3.6.0.v20100517.jar:]
        at 
org.apache.servicemix.nmr.osgi.OsgiServiceRegistryTracker.init(OsgiServiceRegistryTracker.java:67)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)[:1.6.0_21]
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_21]
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_21]
        at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_21]
        at 
org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:221)[7:org.apache.aries.blueprint:0.2.0.incubating]
        at 
org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:844)[7:org.apache.aries.blueprint:0.2.0.incubating]
        at 
org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:633)[7:org.apache.aries.blueprint:0.2.0.incubating]
        ... 15 more
Caused by: java.lang.ClassNotFoundException: 
org.springframework.beans.factory.support.BeanDefinitionRegistry
        at 
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)[osgi-3.6.0.v20100517.jar:]
        at 
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)[osgi-3.6.0.v20100517.jar:]
        at 
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)[osgi-3.6.0.v20100517.jar:]
        at 
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)[osgi-3.6.0.v20100517.jar:]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_21]
        ... 40 more


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to