01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: package mx4j.examples.tools.remote.soap;
10:
11: import javax.management.MBeanServer;
12: import javax.management.MBeanServerFactory;
13: import javax.management.remote.JMXConnectorServer;
14: import javax.management.remote.JMXConnectorServerFactory;
15: import javax.management.remote.JMXServiceURL;
16:
17: /**
18: * This example shows how to setup a JSR 160 connector server that uses SOAP as
19: * communication protocol with the client.
20: * MX4J's implementation of the SOAP provider requires Axis 1.1, that in turn requires
21: * a servlet container to run. The default servlet container used is Jetty 4.2.x.
22: * Incoming connections from a client will be accepted by Jetty, handed to the
23: * Axis servlet that interpretes the SOAP invocation, and passed to MX4J's
24: * SOAPConnectorServer implementation, and finally routed the MBeanServer.
25: * Remote notifications are delivered transparently.
26: * To run this example, you need the following jars:
27: * <ul>
28: * <li>MX4J 2.x</li>
29: * <ul>
30: * <li>mx4j.jar</li>
31: * <li>mx4j-remote.jar</li>
32: * <li>mx4j-tools.jar</li>
33: * <li>mx4j-examples.jar</li>
34: * </ul>
35: * <li>Jetty 4.2.x</li>
36: * <ul>
37: * <li>org.mortbay.jetty.jar</li>
38: * <li>servlet.jar</li>
39: * </ul>
40: * <li>Axis 1.1</li>
41: * <ul>
42: * <li>axis.jar</li>
43: * <li>jaxrpc.jar</li>
44: * <li>commons-logging.jar</li>
45: * <li>commons-discovery.jar</li>
46: * <li>saaj.jar</li>
47: * <li>wsdl4j.jar</li>
48: * </ul>
49: * </ul>
50: *
51: * @version : $Revision: 1.1 $
52: */
53: public class Server {
54: public static void main(String[] args) throws Exception {
55: // The MBeanServer
56: MBeanServer server = MBeanServerFactory.createMBeanServer();
57:
58: // Pass null as the host name to tell JMXServiceURL to default to InetAddress.getLocalHost().getHostName()
59: JMXServiceURL url = new JMXServiceURL("soap", null, 8080,
60: "/jmxconnector");
61:
62: // Create and start the SOAPConnectorServer
63: // Jetty will listen on port 8080
64: JMXConnectorServer connectorServer = JMXConnectorServerFactory
65: .newJMXConnectorServer(url, null, server);
66: connectorServer.start();
67:
68: System.out.println("Server up and running");
69: }
70: }
|