Yeah, each spring xml file in servicemix deploy folder will be transformed as a 
bundle so if you drop two spring xml files into servicemix deploy folder you 
get two separate bundles and so two separate classloaders associated with each 
bundle. If you wanna two spring xml files in same context you need put them 
into one bundle.
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat



On 2014-12-11, at 下午7:14, Willem Jiang wrote:

> Can you put these spring xml into a bundle and deploy the bundle into service?
> 
> --  
> Willem Jiang
> 
> Red Hat, Inc.
> Web: http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.iteye.com (Chinese)
> Twitter: willemjiang  
> Weibo: 姜宁willem
> 
> 
> 
> On December 11, 2014 at 6:12:37 PM, BURN, James ([email protected]) wrote:
>> Hi
>> 
>> We have multiple Camel routes in different xml files and I've been trying to 
>> tie them together  
>> under single camelContexts as per
>> http://camel.apache.org/how-do-i-import-routes-from-other-xml-files.html  
>> 
>> I've also been looking at the camel-example-cafe spring examples which 
>> contains  
>> and this obviously works well - however, I can't get this feature to work 
>> with ServiceMix  
>> deploy.
>> 
>> We're using ServiceMix 5.1.1 with Camel 2.13.2.
>> 
>> When I put 2 spring camel routes as per the URL above into the ServiceMix 
>> deploy folder  
>> I get the following errors:
>> 
>> 2014-12-11 10:02:49,904 | INFO | mix-5.1.1/deploy | fileinstall | ? ? | 6 - 
>> org.apache.felix.fileinstall  
>> - 3.2.8 | Updated /opt/apache-servicemix-5.1.1/deploy/TEST-camelcontext.xml  
>> 2014-12-11 10:02:49,938 | INFO | mix-5.1.1/deploy | 
>> ultOsgiApplicationContextCreator  
>> | ? ? | 130 - org.springframework.osgi.extender - 1.2.1 | Discovered 
>> configurations  
>> {osgibundle:/META-INF/spring/*.xml} in bundle [null (TEST-camelcontext.xml)] 
>>  
>> 2014-12-11 10:02:49,939 | INFO | xtenderThread-49 | 
>> OsgiBundleXmlApplicationContext  
>> | ? ? | 86 - org.springframework.context - 3.2.4.RELEASE | Refreshing 
>> OsgiBundleXmlApplicationContext(bundle=TEST-camelcontext.xml,  
>> config=osgibundle:/META-INF/spring/*.xml): startup date [Thu Dec 11 10:02:49 
>> GMT  
>> 2014]; root of context hierarchy
>> 2014-12-11 10:02:49,940 | INFO | mix-5.1.1/deploy | fileinstall | ? ? | 6 - 
>> org.apache.felix.fileinstall  
>> - 3.2.8 | Started bundle: 
>> spring:file:/opt/apache-servicemix-5.1.1/deploy/TEST-camelcontext.xml  
>> 2014-12-11 10:02:49,963 | INFO | xtenderThread-49 | XmlBeanDefinitionReader 
>> | ? ?  
>> | 84 - org.springframework.beans - 3.2.4.RELEASE | Loading XML bean 
>> definitions from  
>> URL [bundle://290.16:0/META-INF/spring/TEST-camelcontext.xml]
>> 2014-12-11 10:02:50,023 | INFO | xtenderThread-49 | XmlBeanDefinitionReader 
>> | ? ?  
>> | 84 - org.springframework.beans - 3.2.4.RELEASE | Loading XML bean 
>> definitions from  
>> OSGi 
>> resource[bundle://290.16:0/META-INF/spring/myroutes.xml|bnd.id=290|bnd.sym=TEST-camelcontext.xml]
>>   
>> 2014-12-11 10:02:50,024 | ERROR | xtenderThread-49 | ContextLoaderListener | 
>> ? ? |  
>> 130 - org.springframework.osgi.extender - 1.2.1 | Application context 
>> refresh failed  
>> (OsgiBundleXmlApplicationContext(bundle=TEST-camelcontext.xml, 
>> config=osgibundle:/META-INF/spring/*.xml))  
>> org.springframework.beans.factory.parsing.BeanDefinitionParsingException:  
>> Configuration problem: Failed to import bean definitions from relative 
>> location [myroutes.xml]  
>> Offending resource: URL 
>> [bundle://290.16:0/META-INF/spring/TEST-camelcontext.xml];  
>> nested exception is 
>> org.springframework.beans.factory.BeanDefinitionStoreException:  
>> IOException parsing XML document from OSGi 
>> resource[bundle://290.16:0/META-INF/spring/myroutes.xml|bnd.id=290|bnd.sym=TEST-camelcontext.xml];
>>   
>> nested exception is java.io.IOException: Resource does not exist: 
>> bundle://290.16:0/META-INF/spring/myroutes.xml  
>> 
>> It would appear that the ServiceMix deploy folder isn't integrating with the 
>> Camel META-INF/spring  
>> folder somehow so the Resource myroutes.xml isn't found.
>> 
>> How should I use ServiceMix to use this Camel multi-route file 
>> functionality? The only  
>> other alternative I can see is to put all our routes in the same XML file 
>> which is very unwieldy.  
>> 
>> Let me know if you need more info (eg the xml files themselves).
>> 
>> Thanks for any advice.
>> 
>> James
>> 
>> Oxford University Press (UK) Disclaimer
>> 
>> This message is confidential. You should not copy it or disclose its 
>> contents to anyone.  
>> You may use and apply the information for the intended purpose only. OUP 
>> does not accept  
>> legal responsibility for the contents of this message. Any views or opinions 
>> presented  
>> are those of the author only and not of OUP. If this email has come to you 
>> in error, please  
>> delete it, along with any attachments. Please note that OUP may intercept 
>> incoming and  
>> outgoing email communications.
>> 
> 

Reply via email to