Karaf failed to startup due to maven resolution failure on specific cases.
--------------------------------------------------------------------------
Key: KARAF-571
URL: https://issues.apache.org/jira/browse/KARAF-571
Project: Karaf
Issue Type: Bug
Components: runtime
Affects Versions: 2.2.0, 2.0.0
Environment: Windows Java 1.6 update 24
Reporter: BARRAULT Hervé
With karaf 2.0.0 and our bundles, we can have the following error (rarely) :
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
As it is not systematic, we suppose that it is link to initialization of maven
configuration.
----------------------------------------------------------------
I think the startup mechanism is :
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 following description explains how to reproduce the behavior for karaf
2.0.0 and karaf 2.2.0
For a better understanding, i will explain with the default karaf 2.2.0
distribution (with fix KARAF-547 for windows)
Put a breakpoint at org.apache.felix.cm.impl.UpdaterThread ( line 67) :
begin of the loop to read the queue. [ for ( ;; ) ]
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 you have
in the updateTasks list : ManagedService Update: pid=org.ops4j.pax.url.mvn as
the first element, you'll see the behavior]
You'll see the following errors in console :
[Thread-6] ERROR org.apache.karaf.features.internal.FeaturesServiceImpl - Error
installing boot feature config: feature not found
[Thread-6] ERROR org.apache.karaf.features.internal.FeaturesServiceImpl - Error
installing boot feature ssh: feature not found
[Thread-6] ERROR org.apache.karaf.features.internal.FeaturesServiceImpl - Error
installing boot feature management: feature not found
I try some commands and I have the following answers :
karaf@root> features:listrepositories
No repositories available.
karaf@root> features:listurl
Loaded URI
No repository URLs are set.
karaf@root> features:list
No features available.
----------------------------------------------------------------
We found a workaround for this problem :
MavenSettingsImpl constructor tries to read a maven settings.xml file to
pre-configure it (at different locations :
System.getProperty( "user.home" ) + "/.m2/settings.xml"
System.getProperty( "maven.home" ) + "/conf/settings.xml"
System.getenv( "M2_HOME" ) + "/conf/settings.xml" .)
So, in the bat launcher i set the M2_HOME and i put a well configured
settings.xml (corresponding to org.ops4j.pax.url.mvn.cfg content) in the
defined directory.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira