Examples of JMXServiceURL


Examples of javax.management.remote.JMXServiceURL

 
  private int retrieveWGACoreStatus() {
    JMXConnector jmxc = null;
    try {
      int jmxPort = WGADesignerPlugin.getDefault().getPreferenceStore().getInt(PreferenceConstants.JMX_PORT);     
      JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://:" + jmxPort + "/jmxrmi");
          jmxc = JMXConnectorFactory.connect(url, null);
          MBeanServerConnection mbean = jmxc.getMBeanServerConnection();
      Object attribute = mbean.getAttribute(new ObjectName("de.innovationgate.WGAMonitor:context=WGAPublisher,name=Information"), "CoreStatus");
      if (attribute != null && attribute instanceof Integer) {       
        return (Integer) attribute;       
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

    return mbs;
  }
 
  public MBeanServer createRemoteMBeanServer(String host,int port) throws Exception{
    mbs = MBeanServerFactory.createMBeanServer();
    JMXServiceURL url = new JMXServiceURL(
        "service:jmx:rmi:///jndi/rmi://"+host+":"+port+"/XFireMbeanServer");
    cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
    cs.start();
    return mbs;
  }
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

        if (server == null) {
            server = MBeanServerFactory.createMBeanServer();
        }
       
        // Create the JMX service URL.
        JMXServiceURL url = new JMXServiceURL(serviceUrl);      
       
        // if the URL is localhost, start up an Registry
        if (serviceUrl.indexOf("localhost") > -1
            && url.getProtocol().compareToIgnoreCase("rmi") == 0) {
            try {
                int port = getURLLocalHostPort(serviceUrl);
                try {
                    LocateRegistry.createRegistry(port);
                } catch (Exception ex) {
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

       
    }   
    public static void main(String[] args) {
        try {

            JMXServiceURL url = new JMXServiceURL(
                      "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/server");
            JMXConnector jmxc = JMXConnectorFactory.connect(url, null);

            mbsc = jmxc.getMBeanServerConnection();
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

    return getMBean().resendDeletedMessage(system);
  }

  private static AdministratorMBean getMBean() throws XException {
    try {
      JMXServiceURL url = new JMXServiceURL(
          "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi");
      JMXConnector jmxc = JMXConnectorFactory.connect(url, null);

      MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

     */
    private static void init(final RegistryComponent registryComponent) throws JMXRemoteException {

        // Create connector
        Map<String, String> environment = new HashMap<String, String>();
        JMXServiceURL jmxServiceURL = null;

        // Build URL
        StringBuilder sb = new StringBuilder(PREFIX_URL_SERVICE);
        URI providerURI = null;
        if (registryComponent != null) {
            try {
                providerURI = new URI(registryComponent.getProviderURL());
            } catch (URISyntaxException e) {
                throw new JMXRemoteException("Cannot get URL from registry component", e);
            }
        } else {
            try {
                providerURI = new URI(DEFAULT_RMI);
            } catch (URISyntaxException e) {
                throw new JMXRemoteException("Cannot get URL from '" + DEFAULT_RMI + "'", e);
            }
        }

        // Switch for the protocol
        String protocol = providerURI.getScheme();
        String protocolName = "rmi";
        if ("iiop".equals(protocol)) {
            protocolName = "iiop";
        }

        sb.append(protocolName);

        // Add suffix URL of the service
        sb.append(SUFFIX_URL_SERVICE);

        // Add rmi URL
        sb.append(protocolName);
        sb.append("://localhost:");
        sb.append(providerURI.getPort());

        // Connector
        sb.append(SUFFIX_URL);
        String url = sb.toString();

        try {
            jmxServiceURL = new JMXServiceURL(url);
        } catch (MalformedURLException e) {
            throw new JMXRemoteException("Cannot create jmxservice url with url '" + url + "'.", e);
        }
        environment.put("jmx.remote.jndi.rebind", "true");
        try {
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

            throw new Exception("Cannot get the rmi.port system property");
        }

        // Connect to the JMX server
        String url = "service:jmx:rmi:///jndi/rmi://localhost:" + rmiPort + "/EasyBeansConnector";
        JMXServiceURL jmxServiceURL = new JMXServiceURL(url);
        JMXConnector connector = JMXConnectorFactory.connect(jmxServiceURL);
        this.mBeanServerConnection = connector.getMBeanServerConnection();

        this.webTester.getTestContext().setBaseUrl("http://localhost:" + httpPort + "/");
    }
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

    private static void startJMXConnectorServer(int port){
        try {
            /* attempt to start the rmi registry */
            startRMIRegistry(port);
            /* start the connector server */
            JMXServiceURL url = new JMXServiceURL(
              "service:jmx:rmi:///jndi/rmi://localhost:" + port + "/testApp");
            Map<String, Object> env = new HashMap<String, Object>();
            JMXAuthenticator authenticator = new MyJMXAuthenticator();
            env.put(JMXConnectorServer.AUTHENTICATOR, authenticator);
            JMXConnectorServer cs =
                 JMXConnectorServerFactory.newJMXConnectorServer(url,
                 env, getMBeanServer());
            cs.start();
            logger.info("JMXConnectorServer started. URL: " + url.toString());
        } catch (IOException e) {
            logger.log(Level.SEVERE, "Failure while starting RMI connector", e);
        }
    }
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

    /* start JSR160 JMXMP connector*/
    private static void startJMXMPConnectorServer(int port){
        try {
            /* start the connector server */
            JMXServiceURL url = new JMXServiceURL(
              "service:jmx:jmxmp://localhost:" + port);
            Map<String, Object> env = new HashMap<String, Object>();
            JMXAuthenticator authenticator = new MyJMXAuthenticator();
            env.put(JMXConnectorServer.AUTHENTICATOR, authenticator);
            JMXConnectorServer cs =
                 JMXConnectorServerFactory.newJMXConnectorServer(url,
                 env, getMBeanServer());
            cs.start();
            logger.info("JMXConnectorServer started. URL: " + url.toString());
        } catch (IOException e) {
            logger.log(Level.SEVERE, "Failure while starting RMI connector", e);
        }
    }
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

public class NotificationListenerTest {

    public static void main(String[] args)
        throws Exception {

        JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9999/testApp");
        JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
        MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
        mbsc.addNotificationListener(
                new ObjectName("jmanage:name=TimeNotificationBroadcaster"),
                new MyNotificationListener(), null, null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.