How do I get JBoss AS 7.2 to register my OSGi services when the bundle is loaded? -
i have created small sample project have reference implementation of osgi spring (i.e. blueprint), , can bundles install, resolve , start ok, service not registered when bundle starts.
i've made entire project available on github can take @ source - jars output build in artifacts
folder, can build project running gradle assemble
.
as i've understood blueprint specification, , particularly this guide, there no need activator class register services if configuration files in right place - in jar, have following under osgi-inf/blueprint/sillyservice.xml
:
<?xml version="1.0" encoding="utf-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> <bean id="sillyservice" class="se.sunstone.silly.service.serviceimpl" init-method="startservice"> </bean> <service ref="helloservice" interface="com.sample.blueprint.helloworld.api.helloworldservice" /> </blueprint>
when deploying bundle, jboss reports bundle active.
when deploy client bundle, there activator class runs following snippet list all registered services:
servicereference[] refs = context.getallservicereferences(null, null); if (refs != null) { logger.info(string.format("there %s references", refs.length)); (servicereference ref : refs) { logger.info(ref); } } else { logger.info("there no registered services."); }
a bunch of services registered osgi framework inside jboss listed, not sillyservice
.
what need make work?
to enable blueprint functionality, need install blueprint extender bundle. there 2 implementations available: apache aries , eclipse gemini. recommend aries, available http://aries.apache.org/
Comments
Post a Comment