You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Björn Schütte <bj...@schuette.se> on 2009/06/15 11:25:13 UTC

[DOSGi] jetty issues

Hi,

I'm still experimenting with dosgi and i wonder how to get things running the way i need them.
I want to have an osgi-based application with distributed components, being able to start, stop and restart some components using cxf-dosgi, secured via ssl. I managed to get ssl running using pax-web, which still uses jetty. But it seems impossible to stop and restart services with it. I have read about the so_reuseaddr issues but i dont know how to configure it and if its convenient in a secure environment.

Any help would be appreciated!

Greetings,
Björn

Re: [DOSGi] jetty issues

Posted by bschuette <bj...@schuetteonline.de>.
Created issue https://issues.apache.org/jira/browse/CXF-2288


David Bosschaert wrote:
> 
> Hi Bjorn,
> 
> So if I understand it correctly, things work fine initially with your
> bundle running, but you get the problem once you stop + start your
> bundle.
> This is probably caused by a bug in the cleanup of endpoints. Please
> file a JIRA :)
> 
> Cheers,
> 
> David
> 
> 2009/6/15 bschuette <bj...@schuetteonline.de>:
>>
>> Thanks for your reply,
>> I still have problems.
>> Let's say i have an Activator class like yours:
>>
>> public class Activator implements BundleActivator {
>>  private ServiceRegistration sr;
>>
>>  public void start(BundleContext context) throws Exception {
>>    Dictionary props = new Hashtable();
>>    props.put("osgi.remote.interfaces", "*");
>>    props.put("osgi.remote.configuration.type", "pojo");
>>    props.put("osgi.remote.configuration.pojo.httpservice.context",
>>      "/auction");
>>    sr = context.registerService(AuctionService.class.getName(),
>>      new AuctionServiceImpl(), props);
>>  }
>>
>>  public void stop(BundleContext context) throws Exception {
>>    sr.unregister();
>>  }
>> }
>>
>> This should use the OSGi HTTP Service that comes along with the cxf dosgi
>> distro (pax-web).
>> If i now start the application and open the osgi console, everything
>> works
>> fine. But, if i stop and then start my demo app, i get the following
>> error
>> message:
>>
>> "WARNING: Problem creating a remote endpoint for mypackage.MyService from
>> CXF PublishHook, reason is CXF DOSGI: problem registering CXF HTTP
>> Servlet"
>>
>> I debugged using the source code of cxf-dosgi 1.0 and found out, the root
>> cause was
>>
>> "org.osgi.service.http.NamespaceException: alias is already in use in
>> this
>> or another context"
>>
>> This does not happen when using the embedded Jetty Server, which I don't
>> want to use.
>>
>> Any suggestions?
>>
>> Björn
>>
>>
>>
>> David Bosschaert wrote:
>>>
>>> Hi Bjorn,
>>>
>>> If you got ssl running with pax-web and want to use that from DOSGi,
>>> you probably need to switch it so that it uses the OSGi HTTP Service.
>>> This is done by setting the
>>> osgi.remote.configuration.pojo.httpservice.context property. Without
>>> that property it will use straight Jetty.
>>>
>>> See here for an example:
>>> http://coderthoughts.blogspot.com/2009/02/distributed-osgi-powered-ajax-webapp.html
>>> See also the reference page:
>>> http://cxf.apache.org/distributed-osgi-reference.html
>>>
>>> Hope this helps,
>>>
>>> David
>>>
>>> 2009/6/15 Björn Schütte <bj...@schuette.se>:
>>>> Hi,
>>>>
>>>> I'm still experimenting with dosgi and i wonder how to get things
>>>> running
>>>> the way i need them.
>>>> I want to have an osgi-based application with distributed components,
>>>> being able to start, stop and restart some components using cxf-dosgi,
>>>> secured via ssl. I managed to get ssl running using pax-web, which
>>>> still
>>>> uses jetty. But it seems impossible to stop and restart services with
>>>> it.
>>>> I have read about the so_reuseaddr issues but i dont know how to
>>>> configure it and if its convenient in a secure environment.
>>>>
>>>> Any help would be appreciated!
>>>>
>>>> Greetings,
>>>> Björn
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-DOSGi--jetty-issues-tp24032884p24034723.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/-DOSGi--jetty-issues-tp24032884p24035156.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: [DOSGi] jetty issues

Posted by David Bosschaert <da...@gmail.com>.
Hi Bjorn,

So if I understand it correctly, things work fine initially with your
bundle running, but you get the problem once you stop + start your
bundle.
This is probably caused by a bug in the cleanup of endpoints. Please
file a JIRA :)

Cheers,

David

2009/6/15 bschuette <bj...@schuetteonline.de>:
>
> Thanks for your reply,
> I still have problems.
> Let's say i have an Activator class like yours:
>
> public class Activator implements BundleActivator {
>  private ServiceRegistration sr;
>
>  public void start(BundleContext context) throws Exception {
>    Dictionary props = new Hashtable();
>    props.put("osgi.remote.interfaces", "*");
>    props.put("osgi.remote.configuration.type", "pojo");
>    props.put("osgi.remote.configuration.pojo.httpservice.context",
>      "/auction");
>    sr = context.registerService(AuctionService.class.getName(),
>      new AuctionServiceImpl(), props);
>  }
>
>  public void stop(BundleContext context) throws Exception {
>    sr.unregister();
>  }
> }
>
> This should use the OSGi HTTP Service that comes along with the cxf dosgi
> distro (pax-web).
> If i now start the application and open the osgi console, everything works
> fine. But, if i stop and then start my demo app, i get the following error
> message:
>
> "WARNING: Problem creating a remote endpoint for mypackage.MyService from
> CXF PublishHook, reason is CXF DOSGI: problem registering CXF HTTP Servlet"
>
> I debugged using the source code of cxf-dosgi 1.0 and found out, the root
> cause was
>
> "org.osgi.service.http.NamespaceException: alias is already in use in this
> or another context"
>
> This does not happen when using the embedded Jetty Server, which I don't
> want to use.
>
> Any suggestions?
>
> Björn
>
>
>
> David Bosschaert wrote:
>>
>> Hi Bjorn,
>>
>> If you got ssl running with pax-web and want to use that from DOSGi,
>> you probably need to switch it so that it uses the OSGi HTTP Service.
>> This is done by setting the
>> osgi.remote.configuration.pojo.httpservice.context property. Without
>> that property it will use straight Jetty.
>>
>> See here for an example:
>> http://coderthoughts.blogspot.com/2009/02/distributed-osgi-powered-ajax-webapp.html
>> See also the reference page:
>> http://cxf.apache.org/distributed-osgi-reference.html
>>
>> Hope this helps,
>>
>> David
>>
>> 2009/6/15 Björn Schütte <bj...@schuette.se>:
>>> Hi,
>>>
>>> I'm still experimenting with dosgi and i wonder how to get things running
>>> the way i need them.
>>> I want to have an osgi-based application with distributed components,
>>> being able to start, stop and restart some components using cxf-dosgi,
>>> secured via ssl. I managed to get ssl running using pax-web, which still
>>> uses jetty. But it seems impossible to stop and restart services with it.
>>> I have read about the so_reuseaddr issues but i dont know how to
>>> configure it and if its convenient in a secure environment.
>>>
>>> Any help would be appreciated!
>>>
>>> Greetings,
>>> Björn
>>
>>
>
> --
> View this message in context: http://www.nabble.com/-DOSGi--jetty-issues-tp24032884p24034723.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: [DOSGi] jetty issues

Posted by bschuette <bj...@schuetteonline.de>.
Thanks for your reply,
I still have problems.
Let's say i have an Activator class like yours:

public class Activator implements BundleActivator {
  private ServiceRegistration sr;

  public void start(BundleContext context) throws Exception { 
    Dictionary props = new Hashtable();
    props.put("osgi.remote.interfaces", "*");
    props.put("osgi.remote.configuration.type", "pojo");
    props.put("osgi.remote.configuration.pojo.httpservice.context",
      "/auction");
    sr = context.registerService(AuctionService.class.getName(), 
      new AuctionServiceImpl(), props);
  }

  public void stop(BundleContext context) throws Exception {
    sr.unregister();
  }
}

This should use the OSGi HTTP Service that comes along with the cxf dosgi
distro (pax-web). 
If i now start the application and open the osgi console, everything works
fine. But, if i stop and then start my demo app, i get the following error
message:

"WARNING: Problem creating a remote endpoint for mypackage.MyService from
CXF PublishHook, reason is CXF DOSGI: problem registering CXF HTTP Servlet"

I debugged using the source code of cxf-dosgi 1.0 and found out, the root
cause was 

"org.osgi.service.http.NamespaceException: alias is already in use in this
or another context"

This does not happen when using the embedded Jetty Server, which I don't
want to use.

Any suggestions?

Björn



David Bosschaert wrote:
> 
> Hi Bjorn,
> 
> If you got ssl running with pax-web and want to use that from DOSGi,
> you probably need to switch it so that it uses the OSGi HTTP Service.
> This is done by setting the
> osgi.remote.configuration.pojo.httpservice.context property. Without
> that property it will use straight Jetty.
> 
> See here for an example:
> http://coderthoughts.blogspot.com/2009/02/distributed-osgi-powered-ajax-webapp.html
> See also the reference page:
> http://cxf.apache.org/distributed-osgi-reference.html
> 
> Hope this helps,
> 
> David
> 
> 2009/6/15 Björn Schütte <bj...@schuette.se>:
>> Hi,
>>
>> I'm still experimenting with dosgi and i wonder how to get things running
>> the way i need them.
>> I want to have an osgi-based application with distributed components,
>> being able to start, stop and restart some components using cxf-dosgi,
>> secured via ssl. I managed to get ssl running using pax-web, which still
>> uses jetty. But it seems impossible to stop and restart services with it.
>> I have read about the so_reuseaddr issues but i dont know how to
>> configure it and if its convenient in a secure environment.
>>
>> Any help would be appreciated!
>>
>> Greetings,
>> Björn
> 
> 

-- 
View this message in context: http://www.nabble.com/-DOSGi--jetty-issues-tp24032884p24034723.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: [DOSGi] jetty issues

Posted by David Bosschaert <da...@gmail.com>.
Hi Bjorn,

If you got ssl running with pax-web and want to use that from DOSGi,
you probably need to switch it so that it uses the OSGi HTTP Service.
This is done by setting the
osgi.remote.configuration.pojo.httpservice.context property. Without
that property it will use straight Jetty.

See here for an example:
http://coderthoughts.blogspot.com/2009/02/distributed-osgi-powered-ajax-webapp.html
See also the reference page:
http://cxf.apache.org/distributed-osgi-reference.html

Hope this helps,

David

2009/6/15 Björn Schütte <bj...@schuette.se>:
> Hi,
>
> I'm still experimenting with dosgi and i wonder how to get things running the way i need them.
> I want to have an osgi-based application with distributed components, being able to start, stop and restart some components using cxf-dosgi, secured via ssl. I managed to get ssl running using pax-web, which still uses jetty. But it seems impossible to stop and restart services with it. I have read about the so_reuseaddr issues but i dont know how to configure it and if its convenient in a secure environment.
>
> Any help would be appreciated!
>
> Greetings,
> Björn