You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Benson Margulies <be...@basistech.com> on 2016/03/05 01:20:58 UTC

Is there anything asynchronous about starting a server?

The code below runs in Karaf. Is there any chance of a caller getting:

<html><body>No service was found.</body></html>

after this has executed?


    bus = BusFactory.newInstance().createBus();
        // set the class loader so that the TCCL is reliably 'us' when
we get called.
        bus.setExtension(bundleContext.getBundle().adapt(BundleWiring.class).getClassLoader(),
ClassLoader.class);
        JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
        sf.setBus(bus);
        sf.setServiceBean(this);
        sf.setAddress("/worker");
        server = sf.create();

Re: Is there anything asynchronous about starting a server?

Posted by Benson Margulies <be...@basistech.com>.
I make my own, to get the class loader right.

package com.basistech.ws.frontend.service;

import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.osgi.framework.wiring.BundleWiring;
import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.ConfigurationPolicy;
import org.osgi.service.component.annotations.Deactivate;

/**
 * A CXF bus, with a correct class loader, as a component.
 */
@Component(configurationPolicy = ConfigurationPolicy.IGNORE)
public class CXFBusImpl implements CXFBus {
    private Bus bus;

    @Activate
    public void activator(ComponentContext context) {
        // Make a bus factory so that the worker and front end, if
co-resident, don't share.
        bus = BusFactory.newInstance().createBus();
        // Set the class loader so we get the correct TCCL.
        bus.setExtension(context.getBundleContext().getBundle().adapt(BundleWiring.class).getClassLoader(),
ClassLoader.class);
    }

    @Deactivate
    public void deactivator() {
        bus.shutdown(false);
    }

    @Override
    public Bus bus() {
        return bus;
    }
}


On Sun, Mar 6, 2016 at 8:23 PM, James Carman <ja...@carmanconsulting.com> wrote:
> That worked!  Thanks again.  By the way, how are you determining which Bus
> to use?  I used BusFactory.getDefaultBus(true).
>
>
> On Sun, Mar 6, 2016 at 5:48 PM James Carman <ja...@carmanconsulting.com>
> wrote:
>
>> This should work very well! Thank you so much! I'll code it up tonight. I
>> will write an open source version of this in the very near future
>> On Sun, Mar 6, 2016 at 5:45 PM Benson Margulies <be...@basistech.com>
>> wrote:
>>
>>> On Sun, Mar 6, 2016 at 5:18 PM, James Carman <ja...@carmanconsulting.com>
>>> wrote:
>>> > It's karaf. I'm building a service that looks up at runtime the
>>> > configuration of the services and then "exports" them accordingly. I'd
>>> like
>>> > to support exporting via CXF and was looking for inspiration.
>>> > On Sun, Mar 6, 2016 at 5:16 PM Benson Margulies <be...@basistech.com>
>>>
>>> I had built what you describe (DS component that had a
>>> multiple-cardinality reference that collected resources, and then set
>>> up a CXF service), but it could never work out the timing of startup.
>>> So, instead, I allow each service to export itself. The base class of
>>> all the services has the following. The depends on having the latest
>>> SCR from 4.0.4 and the following maven-bundle-plugin options.
>>>
>>> <_dsannotations>*</_dsannotations>
>>> <_dsannotations-options>inherit</_dsannotations-options>
>>>
>>> ......
>>>
>>>
>>> /**
>>>  * Start the service.
>>>  * @param resourcePath the resource path.
>>>  */
>>> protected void startService(String resourcePath) {
>>>
>>>     JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>>>     // Setting the bus ensures that the TCCL is this bundle when our
>>> resource classes are called.
>>>     sf.setBus(cxfBus.bus());
>>>     sf.setProvider(new
>>> JacksonJaxbJsonProvider(JsonUtils.getObjectMapper(),
>>>             JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS));
>>>     sf.setProvider(new JsonExceptionMapper());
>>>     sf.setProvider(new WebApplicationExceptionMapper());
>>>     sf.setProvider(new GenericExceptionMapper());
>>>     sf.setServiceBeans(Collections.singletonList(this));
>>>
>>>     String url = sharedService.getUrlPathPrefix() + resourcePath;
>>>     LOG.info(String.format("%s at %s", getClass().getName(), url));
>>>     sf.setAddress(url);
>>>     server = sf.create();
>>> }
>>>
>>> @Activate
>>> public void activate(ComponentContext context) {
>>>     LOG.info("Activating " + getClass().getName());
>>>     startService(getPath());
>>> }
>>>
>>> @Deactivate
>>> public void shutdown() {
>>>     if (server != null) {
>>>         server.destroy();
>>>         server = null;
>>>     }
>>> }
>>>
>>

Re: Is there anything asynchronous about starting a server?

Posted by James Carman <ja...@carmanconsulting.com>.
That worked!  Thanks again.  By the way, how are you determining which Bus
to use?  I used BusFactory.getDefaultBus(true).


On Sun, Mar 6, 2016 at 5:48 PM James Carman <ja...@carmanconsulting.com>
wrote:

> This should work very well! Thank you so much! I'll code it up tonight. I
> will write an open source version of this in the very near future
> On Sun, Mar 6, 2016 at 5:45 PM Benson Margulies <be...@basistech.com>
> wrote:
>
>> On Sun, Mar 6, 2016 at 5:18 PM, James Carman <ja...@carmanconsulting.com>
>> wrote:
>> > It's karaf. I'm building a service that looks up at runtime the
>> > configuration of the services and then "exports" them accordingly. I'd
>> like
>> > to support exporting via CXF and was looking for inspiration.
>> > On Sun, Mar 6, 2016 at 5:16 PM Benson Margulies <be...@basistech.com>
>>
>> I had built what you describe (DS component that had a
>> multiple-cardinality reference that collected resources, and then set
>> up a CXF service), but it could never work out the timing of startup.
>> So, instead, I allow each service to export itself. The base class of
>> all the services has the following. The depends on having the latest
>> SCR from 4.0.4 and the following maven-bundle-plugin options.
>>
>> <_dsannotations>*</_dsannotations>
>> <_dsannotations-options>inherit</_dsannotations-options>
>>
>> ......
>>
>>
>> /**
>>  * Start the service.
>>  * @param resourcePath the resource path.
>>  */
>> protected void startService(String resourcePath) {
>>
>>     JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>>     // Setting the bus ensures that the TCCL is this bundle when our
>> resource classes are called.
>>     sf.setBus(cxfBus.bus());
>>     sf.setProvider(new
>> JacksonJaxbJsonProvider(JsonUtils.getObjectMapper(),
>>             JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS));
>>     sf.setProvider(new JsonExceptionMapper());
>>     sf.setProvider(new WebApplicationExceptionMapper());
>>     sf.setProvider(new GenericExceptionMapper());
>>     sf.setServiceBeans(Collections.singletonList(this));
>>
>>     String url = sharedService.getUrlPathPrefix() + resourcePath;
>>     LOG.info(String.format("%s at %s", getClass().getName(), url));
>>     sf.setAddress(url);
>>     server = sf.create();
>> }
>>
>> @Activate
>> public void activate(ComponentContext context) {
>>     LOG.info("Activating " + getClass().getName());
>>     startService(getPath());
>> }
>>
>> @Deactivate
>> public void shutdown() {
>>     if (server != null) {
>>         server.destroy();
>>         server = null;
>>     }
>> }
>>
>

Re: Is there anything asynchronous about starting a server?

Posted by James Carman <ja...@carmanconsulting.com>.
This should work very well! Thank you so much! I'll code it up tonight. I
will write an open source version of this in the very near future
On Sun, Mar 6, 2016 at 5:45 PM Benson Margulies <be...@basistech.com>
wrote:

> On Sun, Mar 6, 2016 at 5:18 PM, James Carman <ja...@carmanconsulting.com>
> wrote:
> > It's karaf. I'm building a service that looks up at runtime the
> > configuration of the services and then "exports" them accordingly. I'd
> like
> > to support exporting via CXF and was looking for inspiration.
> > On Sun, Mar 6, 2016 at 5:16 PM Benson Margulies <be...@basistech.com>
>
> I had built what you describe (DS component that had a
> multiple-cardinality reference that collected resources, and then set
> up a CXF service), but it could never work out the timing of startup.
> So, instead, I allow each service to export itself. The base class of
> all the services has the following. The depends on having the latest
> SCR from 4.0.4 and the following maven-bundle-plugin options.
>
> <_dsannotations>*</_dsannotations>
> <_dsannotations-options>inherit</_dsannotations-options>
>
> ......
>
>
> /**
>  * Start the service.
>  * @param resourcePath the resource path.
>  */
> protected void startService(String resourcePath) {
>
>     JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>     // Setting the bus ensures that the TCCL is this bundle when our
> resource classes are called.
>     sf.setBus(cxfBus.bus());
>     sf.setProvider(new JacksonJaxbJsonProvider(JsonUtils.getObjectMapper(),
>             JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS));
>     sf.setProvider(new JsonExceptionMapper());
>     sf.setProvider(new WebApplicationExceptionMapper());
>     sf.setProvider(new GenericExceptionMapper());
>     sf.setServiceBeans(Collections.singletonList(this));
>
>     String url = sharedService.getUrlPathPrefix() + resourcePath;
>     LOG.info(String.format("%s at %s", getClass().getName(), url));
>     sf.setAddress(url);
>     server = sf.create();
> }
>
> @Activate
> public void activate(ComponentContext context) {
>     LOG.info("Activating " + getClass().getName());
>     startService(getPath());
> }
>
> @Deactivate
> public void shutdown() {
>     if (server != null) {
>         server.destroy();
>         server = null;
>     }
> }
>

Re: Is there anything asynchronous about starting a server?

Posted by Benson Margulies <be...@basistech.com>.
On Sun, Mar 6, 2016 at 5:18 PM, James Carman <ja...@carmanconsulting.com> wrote:
> It's karaf. I'm building a service that looks up at runtime the
> configuration of the services and then "exports" them accordingly. I'd like
> to support exporting via CXF and was looking for inspiration.
> On Sun, Mar 6, 2016 at 5:16 PM Benson Margulies <be...@basistech.com>

I had built what you describe (DS component that had a
multiple-cardinality reference that collected resources, and then set
up a CXF service), but it could never work out the timing of startup.
So, instead, I allow each service to export itself. The base class of
all the services has the following. The depends on having the latest
SCR from 4.0.4 and the following maven-bundle-plugin options.

<_dsannotations>*</_dsannotations>
<_dsannotations-options>inherit</_dsannotations-options>

......


/**
 * Start the service.
 * @param resourcePath the resource path.
 */
protected void startService(String resourcePath) {

    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    // Setting the bus ensures that the TCCL is this bundle when our
resource classes are called.
    sf.setBus(cxfBus.bus());
    sf.setProvider(new JacksonJaxbJsonProvider(JsonUtils.getObjectMapper(),
            JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS));
    sf.setProvider(new JsonExceptionMapper());
    sf.setProvider(new WebApplicationExceptionMapper());
    sf.setProvider(new GenericExceptionMapper());
    sf.setServiceBeans(Collections.singletonList(this));

    String url = sharedService.getUrlPathPrefix() + resourcePath;
    LOG.info(String.format("%s at %s", getClass().getName(), url));
    sf.setAddress(url);
    server = sf.create();
}

@Activate
public void activate(ComponentContext context) {
    LOG.info("Activating " + getClass().getName());
    startService(getPath());
}

@Deactivate
public void shutdown() {
    if (server != null) {
        server.destroy();
        server = null;
    }
}

Re: Is there anything asynchronous about starting a server?

Posted by James Carman <ja...@carmanconsulting.com>.
It's karaf. I'm building a service that looks up at runtime the
configuration of the services and then "exports" them accordingly. I'd like
to support exporting via CXF and was looking for inspiration.
On Sun, Mar 6, 2016 at 5:16 PM Benson Margulies <be...@basistech.com>
wrote:

> James, no, but I'm happy to share more snippets or gists. Are you in
> Karaf or just in plain Java? I've done a lot of these over the years.
>
> On Sun, Mar 6, 2016 at 4:37 PM, James Carman <ja...@carmanconsulting.com>
> wrote:
> > Benson, is this code on github somewhere? I'm looking to add CXF services
> > at runtime by code and this looks promising.
> > On Sun, Mar 6, 2016 at 4:33 PM Benson Margulies <be...@basistech.com>
> > wrote:
> >
> >> It's also possible that the code on the other end is not, in fact,
> >> trying the correct URL as a health check. I got some evidence of that
> >> today, so this may all be a  false alarm.
> >>
> >> On Sun, Mar 6, 2016 at 4:15 PM, Sergey Beryozkin <sb...@gmail.com>
> >> wrote:
> >> > Interesting, I guess more analysis may be needed.
> >> > Perhaps Jetty does take few seconds to get 'really' ready after
> >> sf.create()
> >> > returns, may be it is Jetty version specific ?
> >> >
> >> > Sergey
> >> >
> >> > On 06/03/16 12:51, Benson Margulies wrote:
> >> >>
> >> >> On Sun, Mar 6, 2016 at 7:08 AM, Sergey Beryozkin <
> sberyozkin@gmail.com>
> >> >> wrote:
> >> >>>
> >> >>> May be the service has not been started (exception is lost, not
> sure)
> >> or
> >> >>> address is wrong ?
> >> >>
> >> >>
> >> >> A moment later all is well.
> >> >>
> >> >>>
> >> >>> Sergey
> >> >>>
> >> >>> On 05/03/16 00:20, Benson Margulies wrote:
> >> >>>>
> >> >>>>
> >> >>>> The code below runs in Karaf. Is there any chance of a caller
> getting:
> >> >>>>
> >> >>>> <html><body>No service was found.</body></html>
> >> >>>>
> >> >>>> after this has executed?
> >> >>>>
> >> >>>>
> >> >>>>       bus = BusFactory.newInstance().createBus();
> >> >>>>           // set the class loader so that the TCCL is reliably 'us'
> >> when
> >> >>>> we get called.
> >> >>>>
> >> >>>>
> >> >>>>
> >>
> bus.setExtension(bundleContext.getBundle().adapt(BundleWiring.class).getClassLoader(),
> >> >>>> ClassLoader.class);
> >> >>>>           JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
> >> >>>>           sf.setBus(bus);
> >> >>>>           sf.setServiceBean(this);
> >> >>>>           sf.setAddress("/worker");
> >> >>>>           server = sf.create();
> >> >>>>
> >> >>>
> >> >
> >> >
> >>
>

Re: Is there anything asynchronous about starting a server?

Posted by Benson Margulies <be...@basistech.com>.
James, no, but I'm happy to share more snippets or gists. Are you in
Karaf or just in plain Java? I've done a lot of these over the years.

On Sun, Mar 6, 2016 at 4:37 PM, James Carman <ja...@carmanconsulting.com> wrote:
> Benson, is this code on github somewhere? I'm looking to add CXF services
> at runtime by code and this looks promising.
> On Sun, Mar 6, 2016 at 4:33 PM Benson Margulies <be...@basistech.com>
> wrote:
>
>> It's also possible that the code on the other end is not, in fact,
>> trying the correct URL as a health check. I got some evidence of that
>> today, so this may all be a  false alarm.
>>
>> On Sun, Mar 6, 2016 at 4:15 PM, Sergey Beryozkin <sb...@gmail.com>
>> wrote:
>> > Interesting, I guess more analysis may be needed.
>> > Perhaps Jetty does take few seconds to get 'really' ready after
>> sf.create()
>> > returns, may be it is Jetty version specific ?
>> >
>> > Sergey
>> >
>> > On 06/03/16 12:51, Benson Margulies wrote:
>> >>
>> >> On Sun, Mar 6, 2016 at 7:08 AM, Sergey Beryozkin <sb...@gmail.com>
>> >> wrote:
>> >>>
>> >>> May be the service has not been started (exception is lost, not sure)
>> or
>> >>> address is wrong ?
>> >>
>> >>
>> >> A moment later all is well.
>> >>
>> >>>
>> >>> Sergey
>> >>>
>> >>> On 05/03/16 00:20, Benson Margulies wrote:
>> >>>>
>> >>>>
>> >>>> The code below runs in Karaf. Is there any chance of a caller getting:
>> >>>>
>> >>>> <html><body>No service was found.</body></html>
>> >>>>
>> >>>> after this has executed?
>> >>>>
>> >>>>
>> >>>>       bus = BusFactory.newInstance().createBus();
>> >>>>           // set the class loader so that the TCCL is reliably 'us'
>> when
>> >>>> we get called.
>> >>>>
>> >>>>
>> >>>>
>> bus.setExtension(bundleContext.getBundle().adapt(BundleWiring.class).getClassLoader(),
>> >>>> ClassLoader.class);
>> >>>>           JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>> >>>>           sf.setBus(bus);
>> >>>>           sf.setServiceBean(this);
>> >>>>           sf.setAddress("/worker");
>> >>>>           server = sf.create();
>> >>>>
>> >>>
>> >
>> >
>>

Re: Is there anything asynchronous about starting a server?

Posted by James Carman <ja...@carmanconsulting.com>.
Benson, is this code on github somewhere? I'm looking to add CXF services
at runtime by code and this looks promising.
On Sun, Mar 6, 2016 at 4:33 PM Benson Margulies <be...@basistech.com>
wrote:

> It's also possible that the code on the other end is not, in fact,
> trying the correct URL as a health check. I got some evidence of that
> today, so this may all be a  false alarm.
>
> On Sun, Mar 6, 2016 at 4:15 PM, Sergey Beryozkin <sb...@gmail.com>
> wrote:
> > Interesting, I guess more analysis may be needed.
> > Perhaps Jetty does take few seconds to get 'really' ready after
> sf.create()
> > returns, may be it is Jetty version specific ?
> >
> > Sergey
> >
> > On 06/03/16 12:51, Benson Margulies wrote:
> >>
> >> On Sun, Mar 6, 2016 at 7:08 AM, Sergey Beryozkin <sb...@gmail.com>
> >> wrote:
> >>>
> >>> May be the service has not been started (exception is lost, not sure)
> or
> >>> address is wrong ?
> >>
> >>
> >> A moment later all is well.
> >>
> >>>
> >>> Sergey
> >>>
> >>> On 05/03/16 00:20, Benson Margulies wrote:
> >>>>
> >>>>
> >>>> The code below runs in Karaf. Is there any chance of a caller getting:
> >>>>
> >>>> <html><body>No service was found.</body></html>
> >>>>
> >>>> after this has executed?
> >>>>
> >>>>
> >>>>       bus = BusFactory.newInstance().createBus();
> >>>>           // set the class loader so that the TCCL is reliably 'us'
> when
> >>>> we get called.
> >>>>
> >>>>
> >>>>
> bus.setExtension(bundleContext.getBundle().adapt(BundleWiring.class).getClassLoader(),
> >>>> ClassLoader.class);
> >>>>           JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
> >>>>           sf.setBus(bus);
> >>>>           sf.setServiceBean(this);
> >>>>           sf.setAddress("/worker");
> >>>>           server = sf.create();
> >>>>
> >>>
> >
> >
>

Re: Is there anything asynchronous about starting a server?

Posted by Benson Margulies <be...@basistech.com>.
It's also possible that the code on the other end is not, in fact,
trying the correct URL as a health check. I got some evidence of that
today, so this may all be a  false alarm.

On Sun, Mar 6, 2016 at 4:15 PM, Sergey Beryozkin <sb...@gmail.com> wrote:
> Interesting, I guess more analysis may be needed.
> Perhaps Jetty does take few seconds to get 'really' ready after sf.create()
> returns, may be it is Jetty version specific ?
>
> Sergey
>
> On 06/03/16 12:51, Benson Margulies wrote:
>>
>> On Sun, Mar 6, 2016 at 7:08 AM, Sergey Beryozkin <sb...@gmail.com>
>> wrote:
>>>
>>> May be the service has not been started (exception is lost, not sure) or
>>> address is wrong ?
>>
>>
>> A moment later all is well.
>>
>>>
>>> Sergey
>>>
>>> On 05/03/16 00:20, Benson Margulies wrote:
>>>>
>>>>
>>>> The code below runs in Karaf. Is there any chance of a caller getting:
>>>>
>>>> <html><body>No service was found.</body></html>
>>>>
>>>> after this has executed?
>>>>
>>>>
>>>>       bus = BusFactory.newInstance().createBus();
>>>>           // set the class loader so that the TCCL is reliably 'us' when
>>>> we get called.
>>>>
>>>>
>>>> bus.setExtension(bundleContext.getBundle().adapt(BundleWiring.class).getClassLoader(),
>>>> ClassLoader.class);
>>>>           JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>>>>           sf.setBus(bus);
>>>>           sf.setServiceBean(this);
>>>>           sf.setAddress("/worker");
>>>>           server = sf.create();
>>>>
>>>
>
>

Re: Is there anything asynchronous about starting a server?

Posted by Sergey Beryozkin <sb...@gmail.com>.
Interesting, I guess more analysis may be needed.
Perhaps Jetty does take few seconds to get 'really' ready after 
sf.create() returns, may be it is Jetty version specific ?

Sergey
On 06/03/16 12:51, Benson Margulies wrote:
> On Sun, Mar 6, 2016 at 7:08 AM, Sergey Beryozkin <sb...@gmail.com> wrote:
>> May be the service has not been started (exception is lost, not sure) or
>> address is wrong ?
>
> A moment later all is well.
>
>>
>> Sergey
>>
>> On 05/03/16 00:20, Benson Margulies wrote:
>>>
>>> The code below runs in Karaf. Is there any chance of a caller getting:
>>>
>>> <html><body>No service was found.</body></html>
>>>
>>> after this has executed?
>>>
>>>
>>>       bus = BusFactory.newInstance().createBus();
>>>           // set the class loader so that the TCCL is reliably 'us' when
>>> we get called.
>>>
>>> bus.setExtension(bundleContext.getBundle().adapt(BundleWiring.class).getClassLoader(),
>>> ClassLoader.class);
>>>           JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>>>           sf.setBus(bus);
>>>           sf.setServiceBean(this);
>>>           sf.setAddress("/worker");
>>>           server = sf.create();
>>>
>>



Re: Is there anything asynchronous about starting a server?

Posted by Benson Margulies <be...@basistech.com>.
On Sun, Mar 6, 2016 at 7:08 AM, Sergey Beryozkin <sb...@gmail.com> wrote:
> May be the service has not been started (exception is lost, not sure) or
> address is wrong ?

A moment later all is well.

>
> Sergey
>
> On 05/03/16 00:20, Benson Margulies wrote:
>>
>> The code below runs in Karaf. Is there any chance of a caller getting:
>>
>> <html><body>No service was found.</body></html>
>>
>> after this has executed?
>>
>>
>>      bus = BusFactory.newInstance().createBus();
>>          // set the class loader so that the TCCL is reliably 'us' when
>> we get called.
>>
>> bus.setExtension(bundleContext.getBundle().adapt(BundleWiring.class).getClassLoader(),
>> ClassLoader.class);
>>          JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>>          sf.setBus(bus);
>>          sf.setServiceBean(this);
>>          sf.setAddress("/worker");
>>          server = sf.create();
>>
>

Re: Is there anything asynchronous about starting a server?

Posted by Sergey Beryozkin <sb...@gmail.com>.
May be the service has not been started (exception is lost, not sure) or 
address is wrong ?

Sergey
On 05/03/16 00:20, Benson Margulies wrote:
> The code below runs in Karaf. Is there any chance of a caller getting:
>
> <html><body>No service was found.</body></html>
>
> after this has executed?
>
>
>      bus = BusFactory.newInstance().createBus();
>          // set the class loader so that the TCCL is reliably 'us' when
> we get called.
>          bus.setExtension(bundleContext.getBundle().adapt(BundleWiring.class).getClassLoader(),
> ClassLoader.class);
>          JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>          sf.setBus(bus);
>          sf.setServiceBean(this);
>          sf.setAddress("/worker");
>          server = sf.create();
>