The Artima Developer Community
Sponsored Link

Java Answers Forum
Problem to Connect JMXConnectorServer

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Gourab Guha

Posts: 1
Nickname: babai2005
Registered: Nov, 2005

Problem to Connect JMXConnectorServer Posted: Nov 4, 2005 5:50 AM
Reply to this message Reply
Advertisement
Hi

I am getting one exception when I am trying to connect to a JMXConnectorServer.

Here is the code.

import java.util.HashMap;
import java.util.Map;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import javax.naming.Context;

public class TestClient
{

public static void main(String[] args)
{
try
{
// Code example that uses the JNDI short form specifying JNDI properties via environment Map
// The JNDI environment
Map environment = new HashMap();
environment.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.rmi.registry.Regi stryContextFactory");
environment.put(Context.PROVIDER_URL,"rmi://localhost:1099");
// The JNDI short form JMXServiceURL
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://localhost/jndi/jndiPath");

// Connect to the server side
JMXConnector connector = JMXConnectorFactory.connect(url, environment);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}


Here is the StackTrace

java.lang.ClassCastException: mx4j.adaptor.rmi.RMIAdaptor_Stub
at javax.management.remote.rmi.RMIConnector.narrowJRMPServer(Unknown Source)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(Unknown Source)
at javax.management.remote.rmi.RMIConnector.findRMIServer(Unknown Source)
at javax.management.remote.rmi.RMIConnector.connect(Unknown Source)
at javax.management.remote.JMXConnectorFactory.connect(Unknown Source)
at TestClient.main(TestClient.java:27)

Topic: Linking external jar while launching a jar problem Previous Topic   Next Topic Topic: Arrays & Methods

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use