Hello Peter,

Thank you ever so much for taking the time and trouble to reply to my query with these pointers. I have tried the latter with great success but as the configurer option is going to become unsupported, as a very exciting exercise (yes... my own first small bundle), I will also try the former.

As a new OSGI user and a newcomer on this list, I would also like to take the opportunity of this message to thank you for the constant support you, and others on the core team, keep providing and pushing here and via the great bnd/enRoute Tools to make the amazing OSGI tech more accessible to us all.

Kind regards,

Loïc de Montaignac



On 03/10/2016 08:31, Peter Kriens wrote:
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

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to