I'm trying to use declarative services in a web application bundle and I 
haven't found a lot of examples online on how to do this.

 

I'm using BND component annotations for my declarative service component along 
with the -wab flag to set the Bundle-Classpath properly.  This will place my 
component implementation under WEB-INF/classes as is required by a web 
application and adds WEB-INF/classes to my Bundle-Classpath.  In addition, BND 
will place a declarative services component XML file under OSGI-INF at the root 
or the bundle file and create a service component entry in the manifest 
containing that file.

 

When I load the bundle, I get the error that the component description XML 
cannot be found.  I'm guessing that is because the declarative service 
component runtime is trying to the find the XML as a resource using the bundle 
class loader.

 

Should I be adding something to my Bundle-Classpath to find this or should the 
service component runtime still be able to find the XML file?

 

This using the latest SCR, 1.6.0.

 

As an overview, this is what my bundle looks like:

·         META-INF

o   MANIFEST.MF, contains (plus other stuff):

§  Service-Component: 
OSGI-INF/org.example.thosecomponents.ControlServiceImpl.xml

§  Bundle-ClassPath: 
WEB-INF/classes,WEB-INF/lib/primefaces-3.3.1.jar,WEB-INF/lib/start-1.0.6.jar

·         OSGI-INF

o   org.example.thosecomponents.ControlServiceImpl.xml

·         WEB-INF

o   classes

§  org

·         example

o   ...

o   lib

§  primefaces-3.3.1.jar

§  start-1.0.6.jar

·         ...

Reply via email to