Tuesday June 05, 2007 com.sun.jmx.remote.ws.wsman.JMXWSManServiceEndpoint inside a JAX-WS compliant servlet container. When created, the endpoint gets a reference to the platform MBeanServer (thanks to java.lang.management.ManagementFactory.getPlatformMBeanServer())JMXWSManServiceEndpoint and provide your own MBeanServer.
JMXWSManServiceEndpoint JAX-WS endpoint is annotated), the extended class doesn't inherite from the mother class annotations, you need to re-annotate the extended class.setURL on JMXWSManServiceEndpoint class. This URL is used when translating from MBean ObjectName to WS-Addressing EPR.
javax.management.MBeanServerFactory class. The URL on which the endpoint has been deployed is hard coded. You can easily externalize it, for example read it from a property file.
import com.sun.jmx.remote.ws.api.JMXWSManDispatcher;
import com.sun.jmx.remote.ws.api.JMXWSManServiceEndpoint;
import javax.xml.ws.WebServiceContext;
import javax.annotation.Resource;
import javax.management.*;
@javax.xml.ws.WebServiceProvider
@javax.xml.ws.ServiceMode(value=javax.xml.ws.Service.Mode.MESSAGE)
public class ExtendedEndpoint extends JMXWSManServiceEndpoint {
@Resource
private WebServiceContext context;
public ExtendedEndpoint() throws Exception {
super(new JMXWSManDispatcher(null,
(MBeanServer)MBeanServerFactory.findMBeanServer(null).get(0)));
}
protected WebServiceContext getWebServiceContext() {
return context;
}
}
<?xml version="1.0" encoding="UTF-8"?>
< endpoints
xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
version="2.0">
< endpoint
name="JMXWSManEndpoint"
implementation="ExtendedEndpoint"
service="{http://jsr262.dev.java.net/jmxconnector/wsdl}JMXConnectorService"
port="{http://jsr262.dev.java.net/jmxconnector/wsdl}JMXConnectorPort"
url-pattern="/jmxws"
binding="http://www.w3.org/2003/05/soap/bindings/HTTP/">
</endpoint>
</endpoints>
A. Sundararajan
Alan Bateman
Daniel Fuchs
Éamonn McManus
Joël Féraud
Mandy Chung
Luis-Miguel Alventosa
Posted by JMX, SNMP, Java, etc... on June 06, 2007 at 11:16 AM GMT+02:00 #