Thanks, I've just removed my BundleActivator and redeployed my app to Karaf. It just doesn't pick up the Spring config file... Any other idea? Regards, J.
2012/8/10 Jean-Baptiste Onofré <[email protected]> > Hi Julien, > > You don't need any Activator with Spring-DM (and Blueprint). > > Put directly your beans.xml in META-INF/spring and Karaf will load it for > you. > > Regards > JB > > > On 08/10/2012 06:37 PM, Julien Martin wrote: > >> Hello, >> I managed to successfully install and start my bundle. However, nothing >> really happens once I have "osgi:start 88" started my bundle with id 88. >> The business logic is not run... >> >> Here is my activator: >> >> *import org.osgi.framework.**BundleActivator;* >> *import org.osgi.framework.**BundleContext;* >> *import org.springframework.context.**support.** >> ClassPathXmlApplicationContext**;* >> * >> * >> *public class Activator implements BundleActivator {* >> * >> * >> *private BundleContext context;* >> * >> * >> *@Override* >> *public void start(BundleContext context) throws Exception {* >> *this.context = context;* >> *new ClassPathXmlApplicationContext**("META-INF/spring/batch-demo-** >> trc.xml");* >> *}* >> * >> * >> *@Override* >> *public void stop(BundleContext context) throws Exception {* >> *this.context = context;* >> *// TODO Auto-generated method stub* >> *}* >> * >> * >> *}* >> >> >> 2012/8/10 Julien Martin <[email protected] <mailto:[email protected]>> >> >> >> Thanks to both of you. I'll try as you advised and let you know. >> Best regards, >> J. >> >> >> 2012/8/10 Freeman Fang <[email protected] >> <mailto:[email protected]**>> >> >> >> Hi, >> >> The spring deployer is only applicable for a plain spring file, >> for example, you have a plain spring camel router file, when >> you drop it into $KARAF_HOME/deploy folder, a karaf spring >> deployer will kick in and transform the blueprint file into a >> bundle underlying. >> >> In your case, you have a jar which contain mySpringConfig.xml >> and java class, you should OSGi-fy this jar first, that said, >> change it to a bundle yourself. >> You should use bnd tool or more popularly, use >> maven-bundle-plugin to do this task. >> >> Freeman >> ------------- >> Freeman Fang >> >> FuseSource >> Email:[email protected] >> <mailto:Email%3Affang@**fusesource.com<email%[email protected]> >> > >> Web: fusesource.com <http://fusesource.com> >> >> Twitter: freemanfang >> Blog: >> http://freemanfang.blogspot.**com<http://freemanfang.blogspot.com> >> >> http://blog.sina.com.cn/u/**1473905042<http://blog.sina.com.cn/u/1473905042> >> weibo: http://weibo.com/u/1473905042 >> >> On 2012-8-10, at 下午3:49, Julien Martin wrote: >> >> I would be very grateful for some clarification about the >>> following: >>> >>> /"Karaf includes a deployer that is able to deploy plain >>> blueprint or spring-dm configuration files./ >>> /The deployer will transform on the fly any spring >>> >>> configuration file dropped into the deploy folder into a valid >>> OSGi bundle."/ >>> >>> >>> I am not sure what is meant by "spring-dm configuration file"... >>> >>> What I have now is a jar (non-osgi) that contains a >>> META-INF/spring/**mySpringConfig.xml plus the relevant java >>> classe; all dependencies/jars including the spring-dm 1.2.1. >>> >>> How am I supposed to package all that so that the karaf >>> feature described above applies? >>> >>> Regards, >>> >>> Julien. >>> 2012/8/9 Julien Martin <[email protected] >>> <mailto:[email protected]>> >>> >>> >>> thanks Achim >>> >>> >>> 2012/8/9 Achim Nierbeck <[email protected] >>> <mailto:bcanhome@googlemail.**com <[email protected]> >>> >> >>> >>> >>> Hi >>> >>> well if you have placed your spring-application.xml in >>> the right >>> directory of your bundle it'll start right away. >>> This should be something like /META-INF/spring/. >>> If you want to consume other services take a look at >>> the spring-dm >>> documentation on how to reference those. >>> >>> something similar to <reference interface="x.y.z"> >>> will give you a >>> bean to this service. >>> >>> Regards, Achim >>> >>> >>> 2012/8/9 Julien Martin <[email protected] >>> <mailto:[email protected]>>: >>> >>> > Thanks Achim, >>> > 1. I have successfully installed the spring-dm feature. >>> > 2. I will next package my app as a Spring DM app. >>> > 3. What do I do after 2. in order to deploy and >>> manage my app with Karaf? >>> > Regards, >>> > J. >>> > >>> > >>> > 2012/8/9 Achim Nierbeck <[email protected] >>> <mailto:bcanhome@googlemail.**com<[email protected]> >>> >> >>> >>> >> >>> >> Hi, >>> >> >>> >> for starting spring inside a OSGi container you can >>> use spring-dm [1]. >>> >> For Karaf you just need to install the spring-dm >>> feature and then you're >>> >> set. >>> >> As Spring-DM 2.0 is equivalent to blueprint only >>> spring-dm 1.2.1 is >>> >> supported by Karaf right now but this should be >>> sufficient for you. >>> >> >>> >> regards, Achim >>> >> >>> >> [1] - >>> http://static.springsource.** >>> org/osgi/docs/1.2.1/reference/**html/<http://static.springsource.org/osgi/docs/1.2.1/reference/html/> >>> >> >>> >> 2012/8/9 Julien Martin <[email protected] >>> <mailto:[email protected]>>: >>> >>> >> > Hello, >>> >> > >>> >> > I am in the process of developing a Spring app. >>> As it stands the app is >>> >> > currently run as follows by a main class: >>> >> > >>> >> > import >>> >> > >>> org.springframework.context.**support.** >>> ClassPathXmlApplicationContext**; >>> >> > >>> >> > >>> >> > public class Bootstrap { >>> >> > >>> >> > >>> >> > public static void main(String[] args) { >>> >> > >>> >> > new >>> >> > >>> ClassPathXmlApplicationContext** >>> ("spring-integration-demo.xml"**); >>> >> > >>> >> > } >>> >> > >>> >> > >>> >> > } >>> >> > >>> >> > I would like to integrate my app into Apache >>> Karaf (or integrate Apache >>> >> > Karaf into my app?). >>> >> > >>> >> > I am not sure where and how to start. Can someone >>> please provide basic >>> >> > advice and/or pointer to relevant documentation? >>> >> > >>> >> > Thanks in advance, >>> >> > >>> >> > J. >>> >> >>> >> >>> >> >>> >> -- >>> >> >>> >> Apache Karaf <http://karaf.apache.org/> Committer & >>> PMC >>> >> OPS4J Pax Web >>> >>> <http://wiki.ops4j.org/**display/paxweb/Pax+Web/<http://wiki.ops4j.org/display/paxweb/Pax+Web/> >>> > >>> >> Committer & Project Lead >>> >> OPS4J Pax for Vaadin >>> >> >>> <http://team.ops4j.org/wiki/**display/PAXVAADIN/Home<http://team.ops4j.org/wiki/display/PAXVAADIN/Home> >>> > >>> Commiter & Project >>> >> Lead >>> >> blog <http://notizblog.nierbeck.de/**> >>> > >>> > >>> >>> >>> >>> -- >>> >>> Apache Karaf <http://karaf.apache.org/> Committer & PMC >>> OPS4J Pax Web >>> >>> <http://wiki.ops4j.org/**display/paxweb/Pax+Web/<http://wiki.ops4j.org/display/paxweb/Pax+Web/> >>> > >>> Committer & Project Lead >>> OPS4J Pax for Vaadin >>> >>> <http://team.ops4j.org/wiki/**display/PAXVAADIN/Home<http://team.ops4j.org/wiki/display/PAXVAADIN/Home> >>> > >>> Commiter & Project >>> Lead >>> blog <http://notizblog.nierbeck.de/**> >>> >>> >>> >>> >> >> >> > -- > Jean-Baptiste Onofré > [email protected] > http://blog.nanthrax.net > Talend - http://www.talend.com >
