[jboss-user] [Spring Integration] - Re: How to access deployed bean reference from a different s

marius.bogoevici do-not-reply at jboss.com
Thu Nov 26 00:12:51 EST 2009


Post #2, sorry for moving this by mistake.

"ivanyuan" wrote : Hi Marius,
  | 
  | I also tried using the following spring bean context file
  | 
  |   | <?xml version="1.0" encoding="UTF-8"?>
  |   | <beans xmlns="http://www.springframework.org/schema/beans"
  |   |     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |   |     xmlns:jaxrs="http://cxf.apache.org/jaxrs"
  |   |     xmlns:aop="http://www.springframework.org/schema/aop"
  |   |     xmlns:jee="http://www.springframework.org/schema/jee"
  |   |     xsi:schemaLocation="http://www.springframework.org/schema/beans
  |   |     	http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
  |   |     	http://cxf.apache.org/jaxrs
  |   | 		http://cxf.apache.org/schemas/jaxrs.xsd
  |   | 		http://www.springframework.org/schema/aop
  |   |     	http://www.springframework.org/schema/aop/spring-aop.xsd
  |   |     	http://www.springframework.org/schema/jee
  |   |     	http://www.springframework.org/schema/jee/spring-jee-2.0.xsd">
  |   |     	
  |   | 	<jee:jndi-lookup id="myBeanFactory" jndi-name="ProvisioningBillingFramework"/>
  |   | 	
  |   | 	<bean id="myTestBean" class="com.iseemedia.bean.test.TestBean">
  |   | 		<property name="parentBeanFactory" ref="myBeanFactory"/>
  |   | 	</bean>
  |   | 
  |   | </beans>
  |   | 
  | 
  | But I got the following exception. My question is how to access the bean factory or the deployed bean from a spring context which is outside of the spring archive.
  | 
  | 
  |   | java.lang.reflect.InvocationTargetException
  |   | 
  |   | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |   | 
  |   | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |   | 
  |   | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   | 
  |   | 	at java.lang.reflect.Method.invoke(Method.java:585)
  |   | 
  |   | 	at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216)
  |   | 
  |   | 	at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:216)
  |   | 
  |   | 	at org.apache.commons.digester.Rule.end(Rule.java:230)
  |   | 
  |   | 	at org.apache.commons.digester.Digester.endElement(Digester.java:1130)
  |   | 
  |   | 	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
  |   | 
  |   | 	at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source)
  |   | 
  |   | 	at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
  |   | 
  |   | 	at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
  |   | 
  |   | 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
  |   | 
  |   | 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
  |   | 
  |   | 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
  |   | 
  |   | 	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
  |   | 
  |   | 	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
  |   | 
  |   | 	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
  |   | 
  |   | 	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
  |   | 
  |   | 	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
  |   | 
  |   | 	at org.apache.commons.digester.Digester.parse(Digester.java:1685)
  |   | 
  |   | 	at org.mule.config.builders.AbstractDigesterConfiguration.process(AbstractDigesterConfiguration.java:101)
  |   | 
  |   | 	at org.mule.config.builders.MuleXmlConfigurationBuilder.configure(MuleXmlConfigurationBuilder.java:268)
  |   | 
  |   | 	at org.mule.config.builders.MuleXmlConfigurationBuilder.configure(MuleXmlConfigurationBuilder.java:221)
  |   | 
  |   | 	at org.mule.ra.MuleResourceAdapter.start(MuleResourceAdapter.java:112)
  |   | 
  |   | 	at org.jboss.resource.deployment.RARDeployment.startService(RARDeployment.java:109)
  |   | 
  |   | 	at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
  |   | 
  |   | 	at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
  |   | 
  |   | 	at org.jboss.system.ServiceDynamicMBeanSupport.invoke(ServiceDynamicMBeanSupport.java:124)
  |   | 
  |   | 	at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
  |   | 
  |   | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  |   | 
  |   | 	at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
  |   | 
  |   | 	at $Proxy0.start(Unknown Source)
  |   | 
  |   | 	at org.jboss.system.ServiceController.start(ServiceController.java:417)
  |   | 
  |   | 	at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
  |   | 
  |   | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   | 
  |   | 	at java.lang.reflect.Method.invoke(Method.java:585)
  |   | 
  |   | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  |   | 
  |   | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  |   | 
  |   | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  |   | 
  |   | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  |   | 
  |   | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  |   | 
  |   | 	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  |   | 
  |   | 	at $Proxy49.start(Unknown Source)
  |   | 
  |   | 	at org.jboss.deployment.SimpleSubDeployerSupport.startService(SimpleSubDeployerSupport.java:356)
  |   | 
  |   | 	at org.jboss.deployment.SimpleSubDeployerSupport.start(SimpleSubDeployerSupport.java:127)
  |   | 
  |   | 	at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
  |   | 
  |   | 	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
  |   | 
  |   | 	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
  |   | 
  |   | 	at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
  |   | 
  |   | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   | 
  |   | 	at java.lang.reflect.Method.invoke(Method.java:585)
  |   | 
  |   | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  |   | 
  |   | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  |   | 
  |   | 	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  |   | 
  |   | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   | 
  |   | 	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  |   | 
  |   | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   | 
  |   | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  |   | 
  |   | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  |   | 
  |   | 	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  |   | 
  |   | 	at $Proxy9.deploy(Unknown Source)
  |   | 
  |   | 	at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
  |   | 
  |   | 	at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
  |   | 
  |   | 	at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
  |   | 
  |   | 	at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
  |   | 
  |   | 	at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
  |   | 
  |   | 	at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
  |   | 
  |   | 	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
  |   | 
  |   | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   | 
  |   | 	at java.lang.reflect.Method.invoke(Method.java:585)
  |   | 
  |   | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  |   | 
  |   | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  |   | 
  |   | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  |   | 
  |   | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  |   | 
  |   | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  |   | 
  |   | 	at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
  |   | 
  |   | 	at $Proxy0.start(Unknown Source)
  |   | 
  |   | 	at org.jboss.system.ServiceController.start(ServiceController.java:417)
  |   | 
  |   | 	at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
  |   | 
  |   | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   | 
  |   | 	at java.lang.reflect.Method.invoke(Method.java:585)
  |   | 
  |   | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  |   | 
  |   | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  |   | 
  |   | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  |   | 
  |   | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  |   | 
  |   | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  |   | 
  |   | 	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  |   | 
  |   | 	at $Proxy4.start(Unknown Source)
  |   | 
  |   | 	at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
  |   | 
  |   | 	at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
  |   | 
  |   | 	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
  |   | 
  |   | 	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
  |   | 
  |   | 	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
  |   | 
  |   | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |   | 
  |   | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |   | 
  |   | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |   | 
  |   | 	at java.lang.reflect.Method.invoke(Method.java:585)
  |   | 
  |   | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  |   | 
  |   | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  |   | 
  |   | 	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  |   | 
  |   | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   | 
  |   | 	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  |   | 
  |   | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  |   | 
  |   | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  |   | 
  |   | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  |   | 
  |   | 	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  |   | 
  |   | 	at $Proxy5.deploy(Unknown Source)
  |   | 
  |   | 	at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
  |   | 
  |   | 	at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
  |   | 
  |   | 	at org.jboss.Main.boot(Main.java:200)
  |   | 
  |   | 	at org.jboss.Main$1.run(Main.java:508)
  |   | 
  |   | 	at java.lang.Thread.run(Thread.java:595)
  |   | 
  |   | Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myBeanFactory': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: ProvisioningBillingFramework not bound
  |   | 
  | 
  | Could you please give an instruction on how to make deployed bean available in this scenario?
  | 
  | Thank you so much!
  | 
  | Ivan Yuan

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4267605#4267605

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4267605



More information about the jboss-user mailing list