You can set the port with configuration admin. See http://felix.apache.org/documentation/subprojects/apache-felix-http-service.html#configuration-properties
You can create a small bundle that reads the environment variables and sets the configuration in Config Admin. In OSGi enRoute you can also use the configurer. Just place the following JSON file in configuration/configuration.json (change the quotes, my mail editor replaces them with smart quotes) [ { “service.pid”: “org.apache.felix.http", “org.osgi.service.http.port”: @{env;BLUEMIX_HTTP_PORT} } ] Caveat: The Configurer is being standardized in OSGi and the upcoming spec does not support the bnd macros. Kind regards, Peter Kriens > On 2 okt. 2016, at 18:34, Loic de MONTAIGNAC <lo...@montaignac.com> wrote: > > Hello, > > I am currently testing ways to run the OSGI enRoute QuickStart tutorial (as > an executable jar straight to a Cloud Foundry java_buildpack) on IBM Bluemix > but, whilst the sample works perfectly locally it fails when deployed on > Bluemix. > > A binding time-out between the cloud container and the app's embedded Jetty > is the cause of the failure. > The timeout occurs because Jetty is started with its default port (or one set > manually) whilst the Bluemix container is assigned a random port number each > time the app is deployed/re-staged (effectively, each time the container is > restarted). > > After Googling without much success, and being new to OSGI, I am left quite > confused by this. > I therefore would be very grateful if anyone could cast some light on what > would be the best approach to assign the freshly generated container's random > port to Jetty (taking into account that the container's port number is a > system environment variable accessible via code) each time the container is > started/restarted. > > Thanks in advance. > > -- > Loic > _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev