Effective October 27, 2012, online and email support for FuseSource products will move to Red Hat support channels. For more information, please see the JIRA Migration to Red Hat FAQ.
As of October 27th, please open all new issues in the Red Hat Customer Portal .
Issue Details (XML | Word | Printable)

Key: ESB-1197
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Guillaume Nodet
Reporter: Joe Luo
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
FUSE ESB

The "org.osgi.service.http.port" in "etc\system.properties" is ignored

Created: 06/May/10 10:10 AM   Updated: 30/Aug/10 07:52 PM
Component/s: None
Affects Version/s: 4.2.0-fuse-01-00
Fix Version/s: 4.2.0-fuse-02-00, 4.3.0-fuse-00-00

External Issue URL: https://issues.apache.org/jira/browse/FELIX-2347


 Description  « Hide
The "org.osgi.service.http.port" in "etc\system.properties" is ignored. It does not have any effect at all. There is one way to change Pax Web HTTP port by creating a "etc\org.ops4j.pax.web.cfg" file and configure "org.osgi.service.http.port" in the new file like:
org.osgi.service.http.port=8080

However, It only works the second time when we start Fuse ESB. The Pax Web Http listening port is aways on default 8181 in the first time when I start Fuse ESB even with the new file "etc\org.ops4j.pax.web.cfg" created.

Here is instruction to reproduce the behaviour:
1. Extract the FUSE ESB 4.2 zip file into a new location;
2. create a "etc\org.ops4j.pax.web.cfg" file and add following line:

org.osgi.service.http.port=8080

3. start the Fuse ESB by "bin\karaf".

You will see that the http port is still on default 8181. If you restart the Fuse ESB, the http port will change to 8080 that is configured in "etc\org.ops4j.pax.web.cfg".

Here is Felix Karaf features.xml file for "http" feature:

<feature name="http" version="1.4.0-fuse-01-00">
<config name="org.ops4j.pax.web">
org.osgi.service.http.port=8181
</config>
<bundle>mvn:org.apache.geronimo.specs/geronimo-servlet_2.5_spec/1.1.2</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jetty-bundle/6.1.22_1</bundle>
<bundle>mvn:org.ops4j.pax.web/pax-web-api/0.7.2</bundle>
<bundle>mvn:org.ops4j.pax.web/pax-web-spi/0.7.2</bundle>
<bundle>mvn:org.ops4j.pax.web/pax-web-runtime/0.7.2</bundle>
<bundle>mvn:org.ops4j.pax.web/pax-web-jetty/0.7.2</bundle>
</feature>

It looks like hard coded "org.osgi.service.http.port=8181" in Felix Karaf somehow overwrite configuration from "etc\xxx" when it is deployed. Only restart of Fuse ESB will make the configuration from "etc\xxx" works.

Here is a suggested fix:
1. remove two lines from "etc\system.properties" file as the port configuration in this file does not make any difference:

# Default port for the OSGI HTTP Service
org.osgi.service.http.port=8181

This step is optional but it would reduce confusion caused to users.

2. create a new "etc\org.ops4j.pax.web.cfg" file and add two lines in this file:

# Default port for the OSGI HTTP Service
org.osgi.service.http.port=8181

3. remove hard coded port configuration from the apache-felix-karaf-1.4.0-fuse-01-00-features.xml:

<feature name="http" version="1.4.0-fuse-01-00">
<bundle>mvn:org.apache.geronimo.specs/geronimo-servlet_2.5_spec/1.1.2</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jetty-bundle/6.1.22_1</bundle>
<bundle>mvn:org.ops4j.pax.web/pax-web-api/0.7.2</bundle>
<bundle>mvn:org.ops4j.pax.web/pax-web-spi/0.7.2</bundle>
<bundle>mvn:org.ops4j.pax.web/pax-web-runtime/0.7.2</bundle>
<bundle>mvn:org.ops4j.pax.web/pax-web-jetty/0.7.2</bundle>
</feature>


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Joe Luo added a comment - 06/May/10 01:57 PM
It should be documented in wiki as well.

Guillaume Nodet added a comment - 06/May/10 06:31 PM
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);
         }
     }

Joe Luo added a comment - 11/May/10 11:22 AM
Unfortunately, it still does not work with the patch.

Joe Luo added a comment - 24/May/10 11:28 AM
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.


Chris Custine added a comment - 30/Aug/10 07:48 PM
Reopening to change fix version.