Hampel, Michael wrote:
Hello,
I am using the Felix RepositoryAdmin on equinox, which works really
fine.
To create my repository.xml I am using the bindex tool provided by Peter
Kriens.
I now ran into a problem which I am not really able to solve:
I install the pax log4j bundle for using log4j in my services. This bundle exports the package org.apache.log4j.xml with a uses clause
for
javax.xml.parsers. The javax.xml.parsers package is also stated in the
import-package clause.
If I activate the bundle in equinox via the console everything is ok,
equinox starts the bundle
and states that javax.xml.parsers was found in the System Bundle.
Now I want to install an apache-commons package, which has a dependency
on log4j with the help
of RepositoryAdmin.
This fails in Resolver.resolve() as the Resolver dedects the unsatisfied
requirement javax.xml.parsers
for the pax log4j bundle.
Of course my repository.xml has no entry for javax.xml.parsers and my
bundle repository does not have the jar file.
Can someone please guide me in the right direction how to solve this
problem?

So, do I understand correctly that you did not install the pax log4j bundle using OBR? If you did, then I wonder why OBR was able to deploy it in the first place, if it cannot resolve its dependency.

Regardless, OBR works by not only using the resources in your repository.xml file as sources for resolving dependencies, but it also uses your installed bundles as sources for resolving dependencies. So, if javax.xml.parsers is available in your system, then it should find it.

Since it sounds like this is being supplied from the system bundle, I guess you could try to print the headers of the system bundle to see if it shows that it exports javax.xml.parsers (I assume there is some way to show bundle headers in Equinox).

If the system bundle is exporting it, check its version, etc. and see if it matches the version, etc. that is being imported by pax log4j. If not, then that is your issue. If so, then I don't really know. Perhaps you could try it on Felix in that case.

Another thing I encountered when using the bindex tool was the
following:
I am also using maven and therefore I want to use the maven repo as
bundle repository.
Of course not all jar files in the maven repo are OSGi bundles.
When bindex generates the repository.xml it adds entries like
<resource id='28' symbolicname='Untitled-534725839' uri='xxx.jar'
version='0.0.0'>
for all non OSGi bundles to the repository.xml.
When initializing the RepositoryAdmin with this repository.xml the
process fails with a NullPointerException as the resource is
missing a presentationname attribute, which is used in the felix
ResourceComparator.
Can I alter this behaviour(bindex or felix obr) somehow via settings or
do I have to change the code?

It sounds like you have to change the code...either modify OBR to handle missing values more elegantly or bindex to ignore non-bundles. However, the easiest approach might be to just edit your repository.xml file to delete invalid resources.

-> richard

Reply via email to