tag:blogger.com,1999:blog-391420546418472250.post9197671680333897033..comments2023-11-05T10:53:43.854+01:00Comments on Java Software Development: Eclipse RCP Application using Spring DMFlavio Donzéhttp://www.blogger.com/profile/06593471906127749750noreply@blogger.comBlogger27125tag:blogger.com,1999:blog-391420546418472250.post-82031935521500178352010-03-22T12:34:43.870+01:002010-03-22T12:34:43.870+01:00Nice Blog and really thanks for the sharing inform...Nice Blog and really thanks for the sharing information - <a href="http://drcsystems.com/" rel="nofollow">Offshore Software Development</a>Johnhttps://www.blogger.com/profile/16307058277040069574noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-87547421638964040882010-02-25T17:06:32.207+01:002010-02-25T17:06:32.207+01:00Hmm strange, do you have all the spring bundles in...Hmm strange, do you have all the spring bundles in you launch?<br /><br />Something I noticed, is this "ref" correct? Should be the ID of the bean not the class. (maybe you have the same name as the class)<br /><br />ref="de.wagner.eclipselink.bl.implementations.BlDataRetreivalService"Flavio Donzéhttps://www.blogger.com/profile/06593471906127749750noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-61514983897629730902010-02-25T16:37:19.834+01:002010-02-25T16:37:19.834+01:00&lt ?xml version="1.0" encoding=&quo...&lt ?xml version="1.0" encoding="UTF-8"?&gt<br />&ltbeans xmlns="http://www.springframework.org/schema/beans"<br /> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"<br /> xsi:schemaLocation="http://www.springframework.org/schema/beans <br /> http://www.springframework.org/schema/beans/spring-beans.xsd<br />http://www.springframework.org/schema/osgi <br />http://www.springframework.org/schema/osgi/spring-osgi.xsd"&gt<br /><br /> &ltosgi:service id="blDataRetreivalService"<br /> ref="de.wagner.eclipselink.bl.implementations.BlDataRetreivalService"<br /> interface="de.wagner.eclipselink.bl.interfaces.IBlDataRetreivalService" /&gt<br />&lt/beans&gtUnknownhttps://www.blogger.com/profile/01175564863990651009noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-17201023503677913042010-02-25T16:34:34.832+01:002010-02-25T16:34:34.832+01:00you have to replace the tag symbols (< and >...you have to replace the tag symbols (< and >) with lt gt otherwise the xml is not posted.Flavio Donzéhttps://www.blogger.com/profile/06593471906127749750noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-38561878029045983412010-02-25T15:59:06.124+01:002010-02-25T15:59:06.124+01:00So here`s my context_osgi_bl.xml files content:
...So here`s my context_osgi_bl.xml files content:<br /><br /><br /><br /><br /> <br /><br /><br />SCHWERWIEGEND: Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=de.wagner.eclipselink.bl, config=osgibundle:/META-INF/spring/*.xml))<br />org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/osgi]<br />Offending resource: URL [bundleentry://176.fwk19621457/META-INF/spring/service_osgi_bl.xml]<br /><br />Do I have to import the namespace from somewhere?<br /><br />BTW thanks for your help ;)Unknownhttps://www.blogger.com/profile/01175564863990651009noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-31946740070707121962010-02-25T15:55:08.374+01:002010-02-25T15:55:08.374+01:00<beans xmlns="http://www.springframework.o...<beans xmlns="http://www.springframework.org/schema/beans"<br /> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br /> xmlns:osgi="http://www.springframework.org/schema/osgi"<br /> xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd<br /> http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">Flavio Donzéhttps://www.blogger.com/profile/06593471906127749750noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-36940982652802295822010-02-25T15:53:28.175+01:002010-02-25T15:53:28.175+01:00you have to put
xmlns:osgi="http://www.spring...you have to put<br />xmlns:osgi="http://www.springframework.org/schema/osgi"<br /><br />and <br />http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd<br />in<br />xsi:schemaLocationFlavio Donzéhttps://www.blogger.com/profile/06593471906127749750noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-39114680823298702852010-02-25T15:34:50.510+01:002010-02-25T15:34:50.510+01:00Hi,
that option helped for me.
Now I can start th...Hi,<br /><br />that option helped for me.<br />Now I can start the application and load a service from my own BlServiceRegistry Class.<br /><br />At that point I recognized, that I should use OSGI-Serives in by Project instead of implementing my own ServiceRegistry.<br /><br />It is no problem to initialize all services in the BlServiceRegistry. But the BlServiceRegistry has to know about the DBServiceRegistry. And because they are in separate bundles, I dont have any bean definitions from the Database available in the Businesslayer. I think if I would use Services I could publish the serviceimpl. of the database as an osgi:service and reuse it in the businesslayer ".xml" Spring file.<br /><br />Unfortunately I got a namespace error when trying to export my beans as an osgi:service.Unknownhttps://www.blogger.com/profile/01175564863990651009noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-14087183019776213762010-02-25T14:06:40.083+01:002010-02-25T14:06:40.083+01:00Hi Quiddix
There is some documentation found at:
...Hi Quiddix<br /><br />There is some documentation found at:<br /><br />http://static.springsource.org/osgi/docs/1.2.1/reference/html-single/<br />6.1. Bundle Format And Manifest Headers<br /><br />Maybe this helps:<br />Spring-Context: *;create-asynchronously:=false<br /><br />If you place a breakpoint at tracker.open(); and wait until all required bundles are started, does it work then?<br />Otherwise it might be some other problem?Flavio Donzéhttps://www.blogger.com/profile/06593471906127749750noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-27824510614990393962010-02-25T13:38:06.363+01:002010-02-25T13:38:06.363+01:00HI Flavio,
I found your article about Spring DM a...HI Flavio,<br /><br />I found your article about Spring DM and RCP Applications. At the moment I try to implement something similar to your example.<br /><br />Instead of using the OSGI Service Registry, we created our own Service-Registry-Class for the Business-Layer and initialize every service as an attribute with Spring DM.<br /><br />If I do implement you example with our Service Registry and I double-click on the viewer there is a text output on the console (so everything works fine). But If I like to call the "getSomething()" methode after creating the viewer, there is a null pointer exception.<br /><br />viewer.setContentProvider(new ViewContentProvider());<br />viewer.setLabelProvider(new ViewLabelProvider());<br />viewer.setInput(getViewSite());<br />ServiceTracker tracker = new ServiceTracker(Activator.getDefault().getContext(), IMyService.class.getName(),null);<br /> tracker.open();<br /> IMyService service = (IMyService) tracker.getService();<br /> System.out.println(service.getSomething());<br /><br />If I check the logs I see that Spring has not finished to initialize the services, but the guy stars and wants do display the viewer. Because of the null pointer exception, it fails.<br /><br />Have you any solution for that problem? Any method to initialize all ".xml" files before beginning to initialize the gui?Unknownhttps://www.blogger.com/profile/01175564863990651009noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-74531072485175041492010-01-26T09:05:50.812+01:002010-01-26T09:05:50.812+01:00Hello,
after you read the service in the second f...Hello,<br /><br />after you read the service in the second file:<br /><br />osgi:reference id="myService" interface="service.MyService"<br /><br />what do you do with it? pass it to a local service/bean in this bundle?<br /><br />Or do you lookup the service using OSGi API?<br /><br />The configuration looks fine and should work in my opinion.Flavio Donzéhttps://www.blogger.com/profile/06593471906127749750noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-64757272944700194652010-01-25T19:36:34.427+01:002010-01-25T19:36:34.427+01:00Hello,
great tutorial, but i have little problem. ...Hello,<br />great tutorial, but i have little problem. My Service is always null!<br />frist xml<br />bean id="myService" <br /> class="service.MyServiceImpl" <br /> init-method="start"<br /> destroy-method="stop"<br /> <br />osgi:service ref="myService" interface="service.MyService"<br /><br />The second xml File<br />osgi:reference id="myService" interface="service.MyService"<br /><br /><br />Console:<br />Jan 25, 2010 7:31:40 PM org.springframework.osgi.extender.internal.activator.ContextLoaderListener start<br />INFO: Starting [org.springframework.osgi.extender] bundle v.[1.1.2.B]<br />Jan 25, 2010 7:31:40 PM org.springframework.osgi.extender.internal.support.ExtenderConfiguration <br />INFO: No custom extender configuration detected; using defaults...<br />Jan 25, 2010 7:31:40 PM org.springframework.scheduling.timer.TimerTaskExecutor afterPropertiesSet<br />INFO: Initializing Timer<br />Jan 25, 2010 7:31:40 PM org.springframework.osgi.extender.support.DefaultOsgiApplicationContextCreator createApplicationContext<br />INFO: Discovered configurations {osgibundle:/META-INF/spring/*.xml} in bundle [Client (client; singleton:=true)]<br />Jan 25, 2010 7:31:40 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh<br />INFO: Refreshing org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@45e228: display name [OsgiBundleXmlApplicationContext(bundle=client, config=osgibundle:/META-INF/spring/*.xml)]; startup date [Mon Jan 25 19:31:40 CET 2010]; root of context hierarchy<br />Jan 25, 2010 7:31:41 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions<br />INFO: Loading XML bean definitions from URL [bundleentry://106.fwk10039797/META-INF/spring/client-context.xml]<br />Jan 25, 2010 7:31:42 PM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory<br />INFO: Bean factory for application context [org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@45e228]: org.springframework.beans.factory.support.DefaultListableBeanFactory@704cf5<br />Jan 25, 2010 7:31:42 PM org.springframework.osgi.extender.internal.dependencies.startup.DependencyServiceManager findServiceDependencies<br />INFO: Adding OSGi service dependency for importer [&myService] matching OSGi filter [(objectClass=service.MyService)]<br />Jan 25, 2010 7:31:42 PM org.springframework.osgi.extender.internal.dependencies.startup.DependencyServiceManager findServiceDependencies<br />INFO: OsgiBundleXmlApplicationContext(bundle=client, config=osgibundle:/META-INF/spring/*.xml) is waiting for unsatisfied dependencies [[&myService]]Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-69863049954382427472009-12-20T04:29:26.525+01:002009-12-20T04:29:26.525+01:00Wonder if anyone is monitoring this any more. All...Wonder if anyone is monitoring this any more. All looks cool but I can't get it to work. I think my problem is versions. I'm using Eclipse 3.5 and Spring 2.5 . I've added the Bundle springDM but it does not find my bundle "org.springframework.osgi.extender"<br /><br />I had no luck with the custom config.ini either I didn't have the expected extender either. I'd sure like to get Spring and RCP to talk to each other. Just not able to know enough to make that happen. <br /><br />Any guidance would be greatly appreciated.Unknownhttps://www.blogger.com/profile/14155356755709299595noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-87807668896479706062009-07-28T16:33:03.735+02:002009-07-28T16:33:03.735+02:00Many thanks for the clear tutorial, Flavio; as oth...Many thanks for the clear tutorial, Flavio; as others have already commented, it was the first such example that worked for me.Sean Rasmussenhttp://www.erasmos.comnoreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-32676962891010629782009-07-08T10:48:08.813+02:002009-07-08T10:48:08.813+02:00Thx a lot, that finally worked for me. Note that w...Thx a lot, that finally worked for me. Note that with spring-osgi-1.2.0 the steps to add org.apache.commons.logging don't seem to be necessary. I just added the com.springsource.slf4j.org.apache.commons.logging-1.5.0.jar from the /lib directory as additional workspace plugin. Indeed I'm not sure if even this is necessary. The generated ini shows a second reference to org.apache.commons.logging_1.0.4.v20080605-1930.jar. But it worked, I'm very happy!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-69473721871438401922009-03-06T05:34:00.000+01:002009-03-06T05:34:00.000+01:00Instead of:org.springframework.bundle.springUse:or...Instead of:<BR/>org.springframework.bundle.spring<BR/><BR/>Use:<BR/>org.springframework.aop;bundle-version="2.5.6",<BR/> com.springsource.org.aopalliance;bundle-version="1.0.0"<BR/><BR/>Otherwise you will get unwanted toolbar items. :)Mark Nuttallhttps://www.blogger.com/profile/11521440812448315535noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-73916584807016190382009-01-16T21:42:00.000+01:002009-01-16T21:42:00.000+01:00Thanks for this nice tutorial. I spend some hours ...Thanks for this nice tutorial. I spend some hours to find a simple and nice introduction about how to use Spring with eclipse RCP. You really did a good job.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-59804192261928727652008-11-15T22:33:00.000+01:002008-11-15T22:33:00.000+01:00Awesome ! This is my first Spring DM that met my R...Awesome ! This is my first Spring DM that met my RCP application ! To be frank I did googled and read lots of articles to get started. I would say none of the articles are as complete as yours ! Keep blogging new articles on Eclipse RCP & Spring DM.<BR/><BR/>Thanks,<BR/>CAN.Anjur Chanhttps://www.blogger.com/profile/05866305346636051339noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-89031340260990162562008-07-18T17:30:00.000+02:002008-07-18T17:30:00.000+02:00@Pedro CavaléroSorry I forgot to follow the commen...@Pedro Cavaléro<BR/>Sorry I forgot to follow the comments of this page ;)<BR/>I forgot to mention that with the spring IDE module for eclipse, there is an optional Spring IDE OSGI Extension that you can install. It will com with the org.springframework.bundle.osgi.extender that you will depend on.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-60821726769008641592008-07-08T17:01:00.000+02:002008-07-08T17:01:00.000+02:00@Pedro CavaléroWhich Eclipse Version are you using...@Pedro Cavaléro<BR/>Which Eclipse Version are you using? I'm using 3.4 and Spring IDE 2.0.6 and I can select them in the dependency editor.Flavio Donzéhttps://www.blogger.com/profile/06593471906127749750noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-55656182621882364872008-07-08T16:38:00.000+02:002008-07-08T16:38:00.000+02:00Thanks for this tutorial! I have a question to mrm...Thanks for this tutorial! I have a question to mrmagne, how did you get this dependencies to run? I have Spring IDE installed and i only can have these plugins if i change the target plataform to [spring plugin path]/release/target. Did you change the target plataform?<BR/>ThanksPedro Cavalérohttps://www.blogger.com/profile/14782915347790726033noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-68506298436614198952008-07-05T18:11:00.000+02:002008-07-05T18:11:00.000+02:00Very good tutorial. I am trying to seperate the pr...Very good tutorial. <BR/><BR/>I am trying to seperate the project in 2 projets. So, my architecture is based on an UI plugin (eclipse rcp) and an CORE plugin (spring osgi/hiberate/server)<BR/><BR/>Can you explain how i must to do ?Sylvain MOUQUEThttps://www.blogger.com/profile/16962028071307582780noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-71498696165731482122008-07-03T14:16:00.000+02:002008-07-03T14:16:00.000+02:00Thanks mrmagne, I didn't like the config.ini eithe...Thanks mrmagne, I didn't like the config.ini either. That looks like a better solution!Flavio Donzéhttps://www.blogger.com/profile/06593471906127749750noreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-32655950921350700242008-07-03T14:09:00.000+02:002008-07-03T14:09:00.000+02:00In fact I also had the problem with org.apache.com...In fact I also had the problem with org.apache.commons.logging, the config.ini I copied form your example was still pointing to the custom org.apache.commons.logging bundle.<BR/><BR/>BTW, I used<BR/><BR/><I>Bundle springDM = Platform.getBundle("org.springframework.bundle.osgi.extender");<BR/> <BR/>springDM.start();</I><BR/><BR/>in my Activator#start() method to avoid using a custom config.iniAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-391420546418472250.post-65916918035922682242008-07-02T12:48:00.000+02:002008-07-02T12:48:00.000+02:00Thanks for this tutorial !!!Just as a side note, b...Thanks for this tutorial !!!<BR/><BR/>Just as a side note, by installing SpringIDE (http://springide.org/blog/) including the OSGI plugin, and making my test plugin depends on org.springframework.bundle.spring, org.springframework.bundle.osgi.core, org.springframework.bundle.osgi.extender and org.springframework.bundle.osgi.io I managed to avoid importing spring modules to my workspace. I think this solution is a little more elegant.<BR/><BR/>I also had no problems with my org.apache.commons.logging so I skipped this part too.Anonymousnoreply@blogger.com