to explain a little more. When you use JaxWsServerFactoryBean.create
or use a jaxws:endpoint in spring (which I would recommend over
programmatic creation anyway), it will start the Jetty instance if it
has not already been started. However it does not stop the instance
for you again automatically that I know of. I guess that might be an
enhancement you could request / or contribute.
If you do use jaxws:endpoint, you can get access to the Server to stop
your endpoint via the code:
org.apache.cxf.jaxws.EndpointImpl endpoint =
(org.apache.cxf.jaxws.EndpointImpl)
context.getBean("MySpringBeanIdForJaxWsEndpoint",
javax.xml.ws.Endpoint.class);
org.apache.cxf.endpoint.Server server = endpoint.getServer();
server.stop();
And then you can shut down the jetty instance if you also need to with:
JettyHTTPServerEngineFactory.destroyForPort(9448);
An enhancement to automatically shutdown the jetty endpoint when the
last server is stopped would be interesting to look at, but has all
sorts of interesting issues with it. For instance in our case at
work, we often stop an endpoint only to redeploy a replacement service
to the same endpoint so we would not want to automatically shut it
down.
its safer to leave that to the individual application to decide, which
I guess is why the method above has been provided.
On Sun, Nov 4, 2012 at 11:49 AM, <[email protected]> wrote:
> Stopping the Server will only remove the endpoint from the started Jetty
> Engine. However you can stop jetty itself
>
> programmtically with something like:
>
> JettyHTTPServerEngineFactory.destroyForPort(9448);
>
>
> Where 9448 is the port number your jetty engine is running on.
>
>
> I don't know what the official recommendation is for this but that will
> certainly do the trick. Although cxf javadoc might not be all up to
> scratch this mailing rocks so its a pretty good alternative.
>
>
> Cheers
>
> Jason
>
>
> Sent from my Galaxy S2
>
> On Nov 1, 2012 3:01 AM, "selvakumar netaji" <[email protected]> wrote:
>>
>> Hi All,
>>
>> I'm new to apache cxf. I have tried out the hello world example. The
>> service is exposed using the JaxWsServerFactoryBean. After starting the
>> server I tested the services. It was working fine and tired to stop the
>> server using the destroy method. It didn't work out. So I tried to see the
>> javadoc but nothing was mentioned in those javadoc except the method
>> summary. The server is stopped only on stopping the vm. Can you please
>> help on this to find out the javadocs.