|
As of October 27th, please open all new issues in the Red Hat Customer Portal . |
|
[
Permlink
| « Hide
]
Joe Luo added a comment - 06/May/10 01:57 PM
It should be documented in wiki as well.
THe following patch should solve the issue. Could you give it a try ?
diff --git a/karaf/features/core/src/main/java/org/apache/felix/karaf/features/internal/FeaturesServiceImpl.java b/karaf/features/core/src/main index 9202d37..9e5d685 100644 --- a/karaf/features/core/src/main/java/org/apache/felix/karaf/features/internal/FeaturesServiceImpl.java +++ b/karaf/features/core/src/main/java/org/apache/felix/karaf/features/internal/FeaturesServiceImpl.java @@ -375,13 +375,16 @@ public class FeaturesServiceImpl implements FeaturesService { for (String config : feature.getConfigurations().keySet()) { Dictionary<String,String> props = new Hashtable<String, String>(feature.getConfigurations().get(config)); String[] pid = parsePid(config); - String key = (pid[1] == null ? pid[0] : pid[0] + "-" + pid[1]); - props.put(CONFIG_KEY, key); - Configuration cfg = getConfiguration(configAdmin, pid[0], pid[1]); - if (cfg.getBundleLocation() != null) { - cfg.setBundleLocation(null); + Configuration cfg = findExistingConfiguration(configAdmin, pid[0], pid[1]); + if (cfg == null) { + cfg = createConfiguration(configAdmin, pid[0], pid[1]); + String key = (pid[1] == null ? pid[0] : pid[0] + "-" + pid[1]); + props.put(CONFIG_KEY, key); + if (cfg.getBundleLocation() != null) { + cfg.setBundleLocation(null); + } + cfg.update(props); } - cfg.update(props); } Set<Long> bundles = new HashSet<Long>(); for (String bundleLocation : feature.getBundles()) { @@ -703,17 +706,12 @@ public class FeaturesServiceImpl implements FeaturesService { } } - protected Configuration getConfiguration(ConfigurationAdmin configurationAdmin, - String pid, String factoryPid) throws IOException, InvalidSyntaxException { - Configuration oldConfiguration = findExistingConfiguration(configurationAdmin, pid, factoryPid); - if (oldConfiguration != null) { - return oldConfiguration; + protected Configuration createConfiguration(ConfigurationAdmin configurationAdmin, + String pid, String factoryPid) throws IOException, InvalidSyntaxException { + if (factoryPid != null) { + return configurationAdmin.createFactoryConfiguration(pid, null); } else { - if (factoryPid != null) { - return configurationAdmin.createFactoryConfiguration(pid, null); - } else { - return configurationAdmin.getConfiguration(pid, null); - } + return configurationAdmin.getConfiguration(pid, null); } } Tested on latest Apache Karaf trunk and it works fine. Also built a patched org.apache.felix.karaf.features.core-1.4.0-fuse-01-00.jar and placed it in Fuse ESB 4.2.0-fuse-01-00 "system\..." repository. It works fine too after a clean start.
With the fix, a new "etc\org.ops4j.pax.web.cfg" file needs to be created with "org.osgi.service.http.port" configure: # Default port for the OSGI HTTP Service
org.osgi.service.http.port=8080
in order to make it work. Reopening to change fix version.
|
|||||||||||||||||||||||||||||||||||||||||