Hi James, Haven't tried it myself, but I think you should be able to use a file: url for the import resource as well. If you don't use a prefix, Spring will default to searching on the classpath inside ServiceMix, but using something like file:routes/myroutes.xml should point to the actual file on disk.
Regards, Gert Vanthienen On Thu, Dec 11, 2014 at 5:45 PM, BURN, James <[email protected]> wrote: > Hi > > We already have extra org.apache.felix.fileinstall-<pid>.cfg files to allow > subfolders for all our routes. I've tried putting the myroutes.xml files in > one of these but they are picked up as individual bundles and remain unable > to be <import>ed by another spring xml file. > > To import, I've tried > > <import resource="routes/myroutes.xml"/> > which gives: > java.io.IOException: Resource does not exist: > bundle://297.12:0/META-INF/spring/routes/myroutes.xml > and > <import resource="classpath*:routes/myroutes.xml"/> > Which doesn't get as far as looking for the myroutes.xml file. > > So, I can't get the xml route files to import. Are there any other things to > try before I have to resort to building in Java? > > Cheers > > James > > > > -----Original Message----- > From: Michael Täschner [mailto:[email protected]] > Sent: 11 December 2014 12:48 > To: [email protected] > Subject: Re: SM trouble picking up multiple Camel routes from different XML > files > > Hi James, > > you could add another felix fileinstall directorywatcher via ConfigAdmin as > managed services. Please check Felix Fileinstall [1] and Config [2] for > details > > Cheers, > Michael > > [1] http://felix.apache.org/site/apache-felix-file-install.html > [2] <smx>/etc/org.apache.felix.fileinstall-deploy.cfg > > 2014-12-11 13:13 GMT+01:00 BURN, James <[email protected]>: > >> Hi Yue >> >> Thanks. Okay, that clarifies things. Just to check, there's no way we >> could define a folder outside of <SM>/deploy where the extra spring >> xml route files could sit and be picked up by the camelContext xml? >> >> This would keep our deployment manageable by non-Java folks. I'm >> guessing the answer's no however... >> >> Maven the best start then? Any other advice for a non-Java bod? >> >> Cheers >> >> James >> >> >> >> -----Original Message----- >> From: Freeman Fang [mailto:[email protected]] >> Sent: 11 December 2014 11:34 >> To: [email protected] >> Subject: Re: SM trouble picking up multiple Camel routes from >> different XML files >> >> 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 >> >> .h >> >> tml >> >> >> >> 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.x >> >> ml >> >> 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| >> >> bn >> >> d.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| >> >> bn d.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. >> >> >> > >> >> >> 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. >> > > 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.
