Hi,
I'm using Karaf 2.0.0 and at the startup (in particular conditions), karaf
doesn't start correctly due to maven resolution failure.

I hope having understand the startup :

The Bundle OPS4J Pax Url - mvn: (start level 5) starts and allows resolution
of mvn protocol (but it is not configured with the dedicated properties file
:org.ops4j.pax.url.mvn.cfg).

The Bundle Apache Felix Configuration Admin Service (start level 10)  :
offers a service to do the configuration of managed services (the
configuration process of mvn will be done here).

The Bundle Apache Karaf :: Features Core :  (start level 30)  reads
org.apache.karaf.features.cfg for features  (using a blueprint
property-placeholder)

But with the configuration in Admin Service is a new Thread so, in some
cases the startup of Features Core is done before the Configuration Admin
Service has started its job to configure the maven url handler.

The result is like this :
java.io.IOException: URL
[mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.3.0-fuse-00-00/xml/features]

could not be resolved. :
mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.3.0-fuse-00-00/xml/features

at
org.apache.karaf.features.internal.RepositoryImpl.load(RepositoryImpl.java:191)

at
org.apache.karaf.features.internal.FeaturesServiceImpl.internalAddRepository(FeaturesServiceImpl.java:168)

at
org.apache.karaf.features.internal.FeaturesServiceImpl.getFeatures(FeaturesServiceImpl.java:704)

at
org.apache.karaf.features.internal.FeaturesServiceImpl.getFeature(FeaturesServiceImpl.java:674)

at
org.apache.karaf.features.internal.FeaturesServiceImpl$1.run(FeaturesServiceImpl.java:751)

Caused by: java.lang.RuntimeException: URL
[mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.3.0-fuse-00-00/xml/features]
could not be resolved.
        at
org.ops4j.pax.url.mvn.internal.Connection.getInputStream(Connection.java:195)

        at
org.apache.karaf.features.internal.RepositoryImpl.load(RepositoryImpl.java:92)

        ... 4 more


I have also noticed that at this step the service logging is not yet
configured (as it is processed by the Configuration Admin Service after the
maven resolver) so i must edit java.util.logging.properties to have some
logs.

To reproduce the bug with an IDE is simple :
    Add a breakpoint in the run method of
org.apache.felix.cm.impl.UpdateThread
    Start KARAF with the KARAF_DEBUG option to be able to attach debugger.
    Attach quickly (the more difficult step) the debugger to be sure that
the thread "Configuration Updater" will be stopped at the beginning.


If order of service registered is safe when bundle level is different, is it
possible to use the Configuration Admin Service to do the job of feature
file loading, so maven, logging service and other configurations are
terminated ?

Or is there a way to be sure that mvn is correctly started before starting
Features Core ?
(I don't want to do a bundle which loop on a bundle using mvn protocol to be
sure of the configuration).

I've seen that there is a known bug which can perhaps be linked to this :
KARAF-334 <https://issues.apache.org/jira/browse/KARAF-334>

Thanks
Hervé

Reply via email to