[
https://issues.apache.org/activemq/browse/SMXCOMP-820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=63248#action_63248
]
Kurt Westerfeld commented on SMXCOMP-820:
-----------------------------------------
Freeman, I actually thought of the same workaround you mentioned in
SMXCOMP-803, and did exactly this. It did not work for us; we have about 12
java services that start at system startup, and some of them have proxies.
Several of them have more than one proxy.
Just a review, I added this to my beans.xml file:
<osgi:reference id="servicemix-cxf-se-component"
interface="javax.jbi.component.Component"
cardinality="1..1"
filter="(NAME=servicemix-cxf-se)" />
And injected this way:
<cxfse:endpoint>
<cxfse:pojo>
<bean class="com.novell.soa.ccm.rbpm.impl.RBPMProvisionImpl">
<property name="component">
<ref bean="servicemix-cxf-se-component" />
And with a companion setter on each java impl:
@WebMethod(exclude=true)
public void setComponent( Component component )
{
this.component = component;
}
Ignore the @WebMethod--we generate wsdls from our java source so we need to
exclude those from wsgen.
When doing this, we get no deployment exceptions, but the behavior is the same.
The injection happens but we do not achieve the dependency on
servicemix-cxf-se being initialized first.
> Services based on servicemix-cxf-se with proxy on smx4/osgi cannot initialize
> -----------------------------------------------------------------------------
>
> Key: SMXCOMP-820
> URL: https://issues.apache.org/activemq/browse/SMXCOMP-820
> Project: ServiceMix Components
> Issue Type: Bug
> Components: servicemix-cxf-se
> Affects Versions: servicemix-xmpp-2010.01
> Environment: fuse-esb 4.3
> Reporter: Kurt Westerfeld
> Assignee: Freeman Fang
>
> Our servicemix-cxf-se components use the proxy feature, and are unable to
> start when servicemix is restarted. The are receiving an exception I will
> paste below.
> What looks to be happening is that the
> org.apache.servicemix.cxfse.CxfSeProxyFactoryBean is unable to use the
> injected component context, and falls into a bit of code that is normally not
> executed, related to finding its client factory using JNDI
> (java:comp/env/jbi/ClientFactory). If I set a breakpoint on this code, and
> unwind the stack one method, I can single step this code and all works fine.
> So, it looks like a startup timing issue to me. Comments in the code lead me
> to believe that under OSGi this should never happen.
> 10:25:14,070 | ERROR | xtenderThread-20 | ContextLoaderListener |
> BundleApplicationContextListener 50 | 73 -
> org.springframework.osgi.extender - 1.2.0 | Application context refresh
> failed (OsgiBundleXmlApplicationContext(bundle=merge-service,
> config=osgibundle:/META-INF/spring/*.xml))
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'org.apache.servicemix.cxfse.CxfSeEndpoint#0' defined in URL
> [bundleentry://224.fwk20591791/META-INF/spring/beans.xml]: Cannot create
> inner bean 'com.novell.soa.ccm.merge.impl.MergeService#0' of type
> [com.novell.soa.ccm.merge.impl.MergeService] while setting bean property
> 'pojo'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'com.novell.soa.ccm.merge.impl.MergeService#0' defined in URL
> [bundleentry://224.fwk20591791/META-INF/spring/beans.xml]: Cannot create
> inner bean 'cxfse:proxy#13a5041' of type
> [org.apache.servicemix.cxfse.CxfSeProxyFactoryBean] while setting bean
> property 'web2Connect'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'cxfse:proxy#13a5041': FactoryBean threw exception on object
> creation; nested exception is javax.naming.NotContextException:
> java:comp/env/jbi/ClientFactory
> 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_18]
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'com.novell.soa.ccm.merge.impl.MergeService#0'
> defined in URL [bundleentry://224.fwk20591791/META-INF/spring/beans.xml]:
> Cannot create inner bean 'cxfse:proxy#13a5041' of type
> [org.apache.servicemix.cxfse.CxfSeProxyFactoryBean] while setting bean
> property 'web2Connect'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'cxfse:proxy#13a5041': FactoryBean threw exception on object
> creation; nested exception is javax.naming.NotContextException:
> java:comp/env/jbi/ClientFactory
> 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.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270)[60:org.springframework.beans:3.0.3.RELEASE]
> ... 17 more
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'cxfse:proxy#13a5041': FactoryBean threw exception on
> object creation; nested exception is javax.naming.NotContextException:
> java:comp/env/jbi/ClientFactory
> at
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)[60:org.springframework.beans:3.0.3.RELEASE]
> at
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:109)[60:org.springframework.beans:3.0.3.RELEASE]
> at
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:274)[60:org.springframework.beans:3.0.3.RELEASE]
> ... 23 more
> Caused by: javax.naming.NotContextException: java:comp/env/jbi/ClientFactory
> at
> org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:171)[77:org.apache.servicemix.naming:1.3.0.fuse-01-00]
> at
> org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:611)[77:org.apache.servicemix.naming:1.3.0.fuse-01-00]
> at
> org.apache.servicemix.naming.InitialContextWrapper.lookup(InitialContextWrapper.java:173)[77:org.apache.servicemix.naming:1.3.0.fuse-01-00]
> at
> javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_18]
> at
> org.apache.servicemix.cxfse.CxfSeProxyFactoryBean.getInternalContext(CxfSeProxyFactoryBean.java:186)[154:servicemix-cxf-se:2010.02.0.fuse-01-00]
> at
> org.apache.servicemix.cxfse.CxfSeProxyFactoryBean.createProxy(CxfSeProxyFactoryBean.java:110)[154:servicemix-cxf-se:2010.02.0.fuse-01-00]
> at
> org.apache.servicemix.cxfse.CxfSeProxyFactoryBean.getObject(CxfSeProxyFactoryBean.java:94)[154:servicemix-cxf-se:2010.02.0.fuse-01-00]
> at
> org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)[60:org.springframework.beans:3.0.3.RELEASE]
> ... 25 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.