Interesting. It would work if you called InstrumentationManager.register(....) with your object. For some reason, we don't do that, but we probably could. We use those annotations to instrument things internally (which is the stuff you DO see in the console) but they need to be registered.

You could put a @PostConstruct method on your bean that would register itself with the manager (which could be spring injected in). Then it should appear.

Dan



On Jul 31, 2008, at 11:51 AM, Ryadh Amar wrote:


Hi,
Thanks for the fast reply, it seems that when you define the endpoint later on, then it becomes available in the console, I wonder who is the culprit ;), I'm a bit disappointed though, I thought that the annotated operations
would show up in the console, but it is not the case.
Correct me if I am wrong, but it seems what I am trying to achieve cannot be
done using the Instrumentation Manager?

by using Spring jmx annotations it works so it's not really a problem, but I thought I was a bit misled by the documentation, I really thought that by annotating the service implementation, that I would be able to manage the
beans via the console.

Anyway thank you very much for your reply.

dkulp wrote:


Did you try putting the jmx stuff before the endpoint bean?    I'm
wondering if the endpoint is created before the Insrumentation manager
is added and thus the InstrumentationManager doesn't know about it.

Dan


On Jul 31, 2008, at 10:54 AM, Ryadh Amar wrote:


Hi all,
I am trying to expose a service endpoint via jmx to be able to
interact with
it via jconsole.
So I apply what is described here :
http://cwiki.apache.org/confluence/display/CXF20DOC/JMX+Management
How to
enable the CXF instrumentationManager
It seems I never manage to register the enpoint, in the console, I
only see
Bus under the org.apache.cxf (in the MBeans tab), in the provided
link, I
should also be able to see Bus.Service.Endpoint, which obviously is
not the
case.
Here is my cxf-config.xml file:
============================
<beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns:jaxws="http://cxf.apache.org/jaxws";
        xsi:schemaLocation="
          http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
          http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd";>

        <import resource="classpath:META-INF/cxf/cxf.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
        <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

        <!-- implementation of the webservice -->
        <bean id="calculatorServiceEndpoint"
                class="org.dyndns.crouille.cxf.CalculatorImpl" />

        <!-- export the webservice using jaxws -->
        <jaxws:endpoint id="calculatorService"
                implementor="#calculatorServiceEndpoint" address="/calculator"
                endpointName="s:calculatorPort" 
serviceName="s:calculatorService"
                xmlns:s="http://cxf.apache.org"; />

        <!-- jmx configuration -->
        <bean id="org.apache.cxf.management.InstrumentationManager"
                
class="org.apache.cxf.management.jmx.InstrumentationManagerImpl">
                <property name="bus" ref="cxf" />
                <property name="enabled" value="true" />
                <property name="threaded" value="false" />
                <property name="daemon" value="false" />
                <property name="JMXServiceURL"
                        
value="service:jmx:rmi:///jndi/rmi://localhost:9914/jmxrmi" />
        </bean>
</beans>
===========================
Here is my annotated implementation of the service endpoint:
============================
package org.dyndns.crouille.cxf;

import javax.management.JMException;
import javax.management.ObjectName;

import org.apache.cxf.management.ManagedComponent;
import org.apache.cxf.management.annotation.ManagedNotification;
import org.apache.cxf.management.annotation.ManagedNotifications;
import org.apache.cxf.management.annotation.ManagedOperation;
import org.apache.cxf.management.annotation.ManagedResource;

@ManagedResource(componentName = "CalculatorImpl", description = "My
Managed
Bean",
      persistPolicy = "OnUpdate", currencyTimeLimit = 15 ,
      log = false ,
      logFile = "jmx.log", persistPeriod = 200,
      persistLocation = "/local/work", persistName = "bar.jmx")
@ManagedNotifications([EMAIL PROTECTED](name = "My Notification",
                                 notificationTypes = {"type.foo",
"type.bar" }) })

public class CalculatorImpl implements CalculatorService,
ManagedComponent {
        @ManagedOperation(description = "Add Two Numbers Together")
        public String add(String a, String b) {
                // TODO Auto-generated method stub
                return 
String.valueOf((Integer.parseInt(a)+Integer.parseInt(b)));
        }

        @ManagedOperation(description = "Multiply Two Numbers Together")
        public String multiply(String a, String b) {
                // TODO Auto-generated method stub
                return 
String.valueOf((Integer.parseInt(a)*Integer.parseInt(b)));
        }

        public ObjectName getObjectName() throws JMException {
                // TODO Auto-generated method stub
                return new ObjectName("org.apache.cxf:type=CalculatorImpl");

        }

}
==============================
I am wondering, since I started java first development, does have
any direct
relation with what I encountering?, maybe this feature doesn't apply
to all
type of services?
Thanks in advance for looking into my problem.
Ryadh.
--
View this message in context:
http://www.nabble.com/CXF-and-JMX-tp18756410p18756410.html
Sent from the cxf-user mailing list archive at Nabble.com.


---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog







--
View this message in context: 
http://www.nabble.com/CXF-and-JMX-tp18756410p18757685.html
Sent from the cxf-user mailing list archive at Nabble.com.


---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog




Reply via email to