You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by gbauer <ba...@gmail.com> on 2010/07/29 17:44:19 UTC

Using JMX to start and stop web services

Hello!

I want to use JMX to temporarily disable an endpoint and enable it
afterwards. I managed to configure JMX according to
http://cxf.apache.org/docs/jmx-management.html and I am able to stop the
service by using the stop-method available in the jmx console (as seen on
one screenshot in the link above). However, if i want to restart the service
using start(), the endpoint doesn't seem to get republished.

Is this a bug or did I miss something (which would be quite likely since im
fairly new to CXF)?

King regards and

TIA,
Gernot
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Using-JMX-to-start-and-stop-web-services-tp2256734p2256734.html
Sent from the cxf-user mailing list archive at Nabble.com.

RE: Using JMX to start and stop web services

Posted by gbauer <ba...@gmail.com>.
I filed the issue as CXF-2920:
https://issues.apache.org/jira/browse/CXF-2920


dvaleri wrote:
> 
> This sounds like it could be a bug related to stopping/starting a service
> that uses the servlet transport.  If you are frequently reloading your
> entire webapp (which is what I suspect the MBean operation you are calling
> is doing) in order to restart the service, you are more likely to hit a
> PermGen space issue with all of the classloader thrashing that goes on
> with
> reloads.  So the reload option is likely not a good long-term solution.
> 
> Since this sounds like a bug and I won't have time to look into it for a
> week or more, your best bet is to file an issue report and somebody will
> pick it up.
> 
> -----Original Message-----
> From: gbauer [mailto:bauer.gernot@gmail.com] 
> Sent: Friday, July 30, 2010 8:13 AM
> To: users@cxf.apache.org
> Subject: RE: Using JMX to start and stop web services
> 
> 
> Hello!
> 
> Sorry for omitting important information, I was in a rush yesterday. I am
> using CXF v2.2.9 and JaxWs as frontend. I create the endpoints by using
> Spring and I deploy the application as war on a tomcat6 servlet container.
> My configuration is pretty similar to the example configuration on the CXF
> homepage (my web.xml[1] and beans.xml[2]).
> 
> I had a look at your testcase and it worked as one would expect.
> Nevertheless when I stop and start my endpoint by using JMX, I cannot
> access
> it even though getState returns "STARTED" again. It is not listed under
> "Available SOAP services" when I access the servlet by using my browser
> and
> every attempt to connect to the service results in "HTTP response '404:
> Not
> Found'".
> 
> I managed to achieve a workaround by using Tomcat's JMX interface and
> calling reload() in the Catalina/WebModule branch. However, I am not sure
> about the side effects of this operation and still wondering if it is
> possible to restart a single endpoint without reloading the whole
> webmodule.
> 
> Kind regards,
> Gernot
> 
> [1] http://pastebin.com/nTh81SY8
> [2] http://pastebin.com/yLN8ExFZ
> 
> 
> dvaleri wrote:
>> 
>> Which type of service are you trying to control (what frontend) and what
>> version of CXF are you using?
>> 
>> This JIRA ticket[1] dealt with similar functionality; however, the tests
>> may
>> not actually cover checking if the service is listening again and may
>> only
>> check that the JMX state is correct.  See ManagedClientServerTest.java
>> [2]
>> for an example that uses JMX to control a published endpoint from the
>> JAX-WS
>> frontend.
>> 
>> [1] https://issues.apache.org/jira/browse/CXF-2740 
>> [2]
>>
> https://svn.apache.org/repos/asf/cxf/trunk/systests/uncategorized/src/test/j
>> ava/org/apache/cxf/systest/management/ManagedClientServerTest.java
>> 
>> -----Original Message-----
>> From: gbauer [mailto:bauer.gernot@gmail.com] 
>> Sent: Thursday, July 29, 2010 11:44 AM
>> To: users@cxf.apache.org
>> Subject: Using JMX to start and stop web services
>> 
>> 
>> Hello!
>> 
>> I want to use JMX to temporarily disable an endpoint and enable it
>> afterwards. I managed to configure JMX according to
>> http://cxf.apache.org/docs/jmx-management.html and I am able to stop the
>> service by using the stop-method available in the jmx console (as seen on
>> one screenshot in the link above). However, if i want to restart the
>> service
>> using start(), the endpoint doesn't seem to get republished.
>> 
>> Is this a bug or did I miss something (which would be quite likely since
>> im
>> fairly new to CXF)?
>> 
>> King regards and
>> 
>> TIA,
>> Gernot
>> -- 
>> View this message in context:
>>
> http://cxf.547215.n5.nabble.com/Using-JMX-to-start-and-stop-web-services-tp2
>> 256734p2256734.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
>> 
>> 
> -- 
> View this message in context:
> http://cxf.547215.n5.nabble.com/Using-JMX-to-start-and-stop-web-services-tp2
> 256734p2259459.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Using-JMX-to-start-and-stop-web-services-tp2256734p2259638.html
Sent from the cxf-user mailing list archive at Nabble.com.

RE: Using JMX to start and stop web services

Posted by David Valeri <dv...@apache.org>.
This sounds like it could be a bug related to stopping/starting a service
that uses the servlet transport.  If you are frequently reloading your
entire webapp (which is what I suspect the MBean operation you are calling
is doing) in order to restart the service, you are more likely to hit a
PermGen space issue with all of the classloader thrashing that goes on with
reloads.  So the reload option is likely not a good long-term solution.

Since this sounds like a bug and I won't have time to look into it for a
week or more, your best bet is to file an issue report and somebody will
pick it up.

-----Original Message-----
From: gbauer [mailto:bauer.gernot@gmail.com] 
Sent: Friday, July 30, 2010 8:13 AM
To: users@cxf.apache.org
Subject: RE: Using JMX to start and stop web services


Hello!

Sorry for omitting important information, I was in a rush yesterday. I am
using CXF v2.2.9 and JaxWs as frontend. I create the endpoints by using
Spring and I deploy the application as war on a tomcat6 servlet container.
My configuration is pretty similar to the example configuration on the CXF
homepage (my web.xml[1] and beans.xml[2]).

I had a look at your testcase and it worked as one would expect.
Nevertheless when I stop and start my endpoint by using JMX, I cannot access
it even though getState returns "STARTED" again. It is not listed under
"Available SOAP services" when I access the servlet by using my browser and
every attempt to connect to the service results in "HTTP response '404: Not
Found'".

I managed to achieve a workaround by using Tomcat's JMX interface and
calling reload() in the Catalina/WebModule branch. However, I am not sure
about the side effects of this operation and still wondering if it is
possible to restart a single endpoint without reloading the whole webmodule.

Kind regards,
Gernot

[1] http://pastebin.com/nTh81SY8
[2] http://pastebin.com/yLN8ExFZ


dvaleri wrote:
> 
> Which type of service are you trying to control (what frontend) and what
> version of CXF are you using?
> 
> This JIRA ticket[1] dealt with similar functionality; however, the tests
> may
> not actually cover checking if the service is listening again and may only
> check that the JMX state is correct.  See ManagedClientServerTest.java [2]
> for an example that uses JMX to control a published endpoint from the
> JAX-WS
> frontend.
> 
> [1] https://issues.apache.org/jira/browse/CXF-2740 
> [2]
>
https://svn.apache.org/repos/asf/cxf/trunk/systests/uncategorized/src/test/j
> ava/org/apache/cxf/systest/management/ManagedClientServerTest.java
> 
> -----Original Message-----
> From: gbauer [mailto:bauer.gernot@gmail.com] 
> Sent: Thursday, July 29, 2010 11:44 AM
> To: users@cxf.apache.org
> Subject: Using JMX to start and stop web services
> 
> 
> Hello!
> 
> I want to use JMX to temporarily disable an endpoint and enable it
> afterwards. I managed to configure JMX according to
> http://cxf.apache.org/docs/jmx-management.html and I am able to stop the
> service by using the stop-method available in the jmx console (as seen on
> one screenshot in the link above). However, if i want to restart the
> service
> using start(), the endpoint doesn't seem to get republished.
> 
> Is this a bug or did I miss something (which would be quite likely since
> im
> fairly new to CXF)?
> 
> King regards and
> 
> TIA,
> Gernot
> -- 
> View this message in context:
>
http://cxf.547215.n5.nabble.com/Using-JMX-to-start-and-stop-web-services-tp2
> 256734p2256734.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 
-- 
View this message in context:
http://cxf.547215.n5.nabble.com/Using-JMX-to-start-and-stop-web-services-tp2
256734p2259459.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: Using JMX to start and stop web services

Posted by gbauer <ba...@gmail.com>.
Hello!

Sorry for omitting important information, I was in a rush yesterday. I am
using CXF v2.2.9 and JaxWs as frontend. I create the endpoints by using
Spring and I deploy the application as war on a tomcat6 servlet container.
My configuration is pretty similar to the example configuration on the CXF
homepage (my web.xml[1] and beans.xml[2]).

I had a look at your testcase and it worked as one would expect.
Nevertheless when I stop and start my endpoint by using JMX, I cannot access
it even though getState returns "STARTED" again. It is not listed under
"Available SOAP services" when I access the servlet by using my browser and
every attempt to connect to the service results in "HTTP response '404: Not
Found'".

I managed to achieve a workaround by using Tomcat's JMX interface and
calling reload() in the Catalina/WebModule branch. However, I am not sure
about the side effects of this operation and still wondering if it is
possible to restart a single endpoint without reloading the whole webmodule.

Kind regards,
Gernot

[1] http://pastebin.com/nTh81SY8
[2] http://pastebin.com/yLN8ExFZ


dvaleri wrote:
> 
> Which type of service are you trying to control (what frontend) and what
> version of CXF are you using?
> 
> This JIRA ticket[1] dealt with similar functionality; however, the tests
> may
> not actually cover checking if the service is listening again and may only
> check that the JMX state is correct.  See ManagedClientServerTest.java [2]
> for an example that uses JMX to control a published endpoint from the
> JAX-WS
> frontend.
> 
> [1] https://issues.apache.org/jira/browse/CXF-2740 
> [2]
> https://svn.apache.org/repos/asf/cxf/trunk/systests/uncategorized/src/test/j
> ava/org/apache/cxf/systest/management/ManagedClientServerTest.java
> 
> -----Original Message-----
> From: gbauer [mailto:bauer.gernot@gmail.com] 
> Sent: Thursday, July 29, 2010 11:44 AM
> To: users@cxf.apache.org
> Subject: Using JMX to start and stop web services
> 
> 
> Hello!
> 
> I want to use JMX to temporarily disable an endpoint and enable it
> afterwards. I managed to configure JMX according to
> http://cxf.apache.org/docs/jmx-management.html and I am able to stop the
> service by using the stop-method available in the jmx console (as seen on
> one screenshot in the link above). However, if i want to restart the
> service
> using start(), the endpoint doesn't seem to get republished.
> 
> Is this a bug or did I miss something (which would be quite likely since
> im
> fairly new to CXF)?
> 
> King regards and
> 
> TIA,
> Gernot
> -- 
> View this message in context:
> http://cxf.547215.n5.nabble.com/Using-JMX-to-start-and-stop-web-services-tp2
> 256734p2256734.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Using-JMX-to-start-and-stop-web-services-tp2256734p2259459.html
Sent from the cxf-user mailing list archive at Nabble.com.

RE: Using JMX to start and stop web services

Posted by David Valeri <dv...@apache.org>.
Which type of service are you trying to control (what frontend) and what
version of CXF are you using?

This JIRA ticket[1] dealt with similar functionality; however, the tests may
not actually cover checking if the service is listening again and may only
check that the JMX state is correct.  See ManagedClientServerTest.java [2]
for an example that uses JMX to control a published endpoint from the JAX-WS
frontend.

[1] https://issues.apache.org/jira/browse/CXF-2740 
[2]
https://svn.apache.org/repos/asf/cxf/trunk/systests/uncategorized/src/test/j
ava/org/apache/cxf/systest/management/ManagedClientServerTest.java

-----Original Message-----
From: gbauer [mailto:bauer.gernot@gmail.com] 
Sent: Thursday, July 29, 2010 11:44 AM
To: users@cxf.apache.org
Subject: Using JMX to start and stop web services


Hello!

I want to use JMX to temporarily disable an endpoint and enable it
afterwards. I managed to configure JMX according to
http://cxf.apache.org/docs/jmx-management.html and I am able to stop the
service by using the stop-method available in the jmx console (as seen on
one screenshot in the link above). However, if i want to restart the service
using start(), the endpoint doesn't seem to get republished.

Is this a bug or did I miss something (which would be quite likely since im
fairly new to CXF)?

King regards and

TIA,
Gernot
-- 
View this message in context:
http://cxf.547215.n5.nabble.com/Using-JMX-to-start-and-stop-web-services-tp2
256734p2256734.html
Sent from the cxf-user mailing list archive at Nabble.com.