[jetty-users] how could I initialize embedded jetty 8 with properties from CM ?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[jetty-users] how could I initialize embedded jetty 8 with properties from CM ?

Cristiano Gavião
Hi,

I'm using
eclipse-SDK-4.2M5/plugins/org.eclipse.equinox.http.jetty_3.0.0.v20111202-1436.jar

And I would like to use Configuration Manager Service to setup the
jetty8.10RC4 initialization.

I've tried this in a bundle config, that is being initialized before
jetty's ones, but is not working:

> properties = getJettyProperties();
> factoryPid = "org.eclipse.equinox.http.jetty.config"
> configuration = configurationAdmin.createFactoryConfiguration(
>                     factoryPid, null);
> configuration.update(properties);

at getJettyProperties I'm adding http.port=8088 to a dictionary.

please, could someone help me ?

regards

Cristiano

_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-users] how could I initialize embedded jetty 8 with properties from CM ?

Hugues Malphettes
Hi Cristiano,

The Configuration Manager Service is not my specialty.
It was developed at the eclipse-platform project.
Can you remind us where is the doc about it and what it does?

Thanks,
Hugues


On Tue, Jan 31, 2012 at 11:50 PM, Cristiano Gavião <[hidden email]> wrote:

> Hi,
>
> I'm using
> eclipse-SDK-4.2M5/plugins/org.eclipse.equinox.http.jetty_3.0.0.v20111202-1436.jar
>
> And I would like to use Configuration Manager Service to setup the
> jetty8.10RC4 initialization.
>
> I've tried this in a bundle config, that is being initialized before jetty's
> ones, but is not working:
>
>> properties = getJettyProperties();
>> factoryPid = "org.eclipse.equinox.http.jetty.config"
>> configuration = configurationAdmin.createFactoryConfiguration(
>>                    factoryPid, null);
>> configuration.update(properties);
>
>
> at getJettyProperties I'm adding http.port=8088 to a dictionary.
>
> please, could someone help me ?
>
> regards
>
> Cristiano
>
> _______________________________________________
> jetty-users mailing list
> [hidden email]
> https://dev.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-users] how could I initialize embedded jetty 8 with properties from CM ?

Cristiano Gavião
Hi Hugues,

I've found this bugzilla where the referred feature was implemented:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=158172.

Investigating at this class
org.eclipse.equinox.http.jetty.internal.Activator I could see that a
ManagerFactory is being created.
But it is not what I was expected because the Http service is being
registered using defaults coming from System Properties...
The CM will be used by this class HttpServerManager, but only when
something in the configuration changes, after the httpservice get up
first time.

I think that my best approach at the moment is to create a wrapper
bundle that gets data from CM at its initialization and start the Jetty
using it .

Now I need to discover what should I do to start jetty by myself.
Perhaps using JettyConfigurator ?


BTW, the best documentation is the OSGi compendium
(http://www.osgi.org/Download/Release4V43).
I've found this too that gives a nice instroduction:
http://dz.prosyst.com/pdoc/mBS_Ext/um_sh/framework-ee-addon/bundles/osgi/config/config.html.


cheers,
Cristiano

On 31/01/12 22:40, Hugues Malphettes wrote:

> Hi Cristiano,
>
> The Configuration Manager Service is not my specialty.
> It was developed at the eclipse-platform project.
> Can you remind us where is the doc about it and what it does?
>
> Thanks,
> Hugues
>
>
> On Tue, Jan 31, 2012 at 11:50 PM, Cristiano Gavião<[hidden email]>  wrote:
>> Hi,
>>
>> I'm using
>> eclipse-SDK-4.2M5/plugins/org.eclipse.equinox.http.jetty_3.0.0.v20111202-1436.jar
>>
>> And I would like to use Configuration Manager Service to setup the
>> jetty8.10RC4 initialization.
>>
>> I've tried this in a bundle config, that is being initialized before jetty's
>> ones, but is not working:
>>
>>> properties = getJettyProperties();
>>> factoryPid = "org.eclipse.equinox.http.jetty.config"
>>> configuration = configurationAdmin.createFactoryConfiguration(
>>>                     factoryPid, null);
>>> configuration.update(properties);
>>
>> at getJettyProperties I'm adding http.port=8088 to a dictionary.
>>
>> please, could someone help me ?
>>
>> regards
>>
>> Cristiano
>>
>> _______________________________________________
>> jetty-users mailing list
>> [hidden email]
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
> _______________________________________________
> jetty-users mailing list
> [hidden email]
> https://dev.eclipse.org/mailman/listinfo/jetty-users

_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-users] how could I initialize embedded jetty 8 with properties from CM ?

Cristiano Gavião
In reply to this post by Hugues Malphettes
I could setup the embedded jetty using a programmatic system property setup:
System.setProperty("org.eclipse.equinox.http.jetty."
                + JettyConstants.HTTP_PORT, "8080");

After that, the ManagedServiceFactory implemented by HttpServerManager is doing its job properly, that is, update using CM data change.

But I've found a issue in this class when a update is being made. maybe because I'm using java 6:

!ENTRY org.eclipse.equinox.cm 4 0 2012-02-01 15:28:07.818
!MESSAGE java.lang.String cannot be cast to java.lang.Integer
!STACK 0
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
    at org.eclipse.equinox.http.jetty.internal.HttpServerManager.createHttpConnector(HttpServerManager.java:134)
    at org.eclipse.equinox.http.jetty.internal.HttpServerManager.updated(HttpServerManager.java:72)
    at org.eclipse.equinox.internal.cm.ManagedServiceFactoryTracker$2.run(ManagedServiceFactoryTracker.java:190)
    at org.eclipse.equinox.internal.cm.SerializedTaskQueue$1.run(SerializedTaskQueue.java:36)
15:28:07.824 [com.c4biz.osgiutils.logging.reader.OsgiLogListener@831fb31] ERROR org.eclipse.equinox.cm - java.lang.String cannot be cast to java.lang.Integer
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
    at org.eclipse.equinox.http.jetty.internal.HttpServerManager.createHttpConnector(HttpServerManager.java:134) ~[na:na]
    at org.eclipse.equinox.http.jetty.internal.HttpServerManager.updated(HttpServerManager.java:72) ~[na:na]
    at org.eclipse.equinox.internal.cm.ManagedServiceFactoryTracker$2.run(ManagedServiceFactoryTracker.java:190) ~[na:na]
    at org.eclipse.equinox.internal.cm.SerializedTaskQueue$1.run(SerializedTaskQueue.java:36) ~[na:na]


The error occurs here:

        Integer httpsPort = (Integer) dictionary.get(JettyConstants.HTTPS_PORT);
        if (httpsPort == null)
            return null;

I've opened an issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=370364

regards,

Cristiano


On 31/01/12 22:40, Hugues Malphettes wrote:
Hi Cristiano,

The Configuration Manager Service is not my specialty.
It was developed at the eclipse-platform project.
Can you remind us where is the doc about it and what it does?

Thanks,
Hugues


On Tue, Jan 31, 2012 at 11:50 PM, Cristiano Gavião [hidden email] wrote:
Hi,

I'm using
eclipse-SDK-4.2M5/plugins/org.eclipse.equinox.http.jetty_3.0.0.v20111202-1436.jar

And I would like to use Configuration Manager Service to setup the
jetty8.10RC4 initialization.

I've tried this in a bundle config, that is being initialized before jetty's
ones, but is not working:

properties = getJettyProperties();
factoryPid = "org.eclipse.equinox.http.jetty.config"
configuration = configurationAdmin.createFactoryConfiguration(
                   factoryPid, null);
configuration.update(properties);

at getJettyProperties I'm adding http.port=8088 to a dictionary.

please, could someone help me ?

regards

Cristiano

_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users