Two Laptop Bag*
The moose likes Distributed Java and the fly likes JMX Conenctor setting in WAS 6.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "JMX Conenctor setting in WAS 6.0" Watch "JMX Conenctor setting in WAS 6.0" New topic
Author

JMX Conenctor setting in WAS 6.0

Akhil Jain
Ranch Hand

Joined: Oct 14, 2004
Posts: 74
WAS 6 has only one option enabled at a time..whether SOAPConnector or RMIConnector under server/Adminsitration/JMX Connectors in WAS Console.

1.Does that mean that since soap connector uses port 8880 then if i switch to RMICOnnector , it will also use the same port?

2.if not,then how can i find out that which port is used by rmi connector?

3.and what is the protocol for accessing that RMIConnector through client(sun client accessing IBM RMICOnnector)
something like :

<rmi-connector protocol>://<remote-host>:<rmiconnector-port>

I have two clients, one using SUN JVM and other using IBM JVM, my Mbean is Deployed and registered with WAS 6.0.

when i am trying to get hooked up to that MBean using IBM Client by using SOAPCOnenctor (using "AdminClient" provided by IBM), all goes well.

but question is, how to use it with SUN Client (MBean will remain on WAS 6.0)?

Can Somebody help me with these questions of mine?


-------------------------------<br />you can't move ahead, unless you try for it.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18840
    
  40


3.and what is the protocol for accessing that RMIConnector through client(sun client accessing IBM RMICOnnector)
something like :
<rmi-connector protocol>://<remote-host>:<rmiconnector-port>


Not exactly clear... but I am assuming that you don't want to use the JNDI API. Instead, you want to use the standard JMX connector APIs, which uses a service URL to specify the target. The main advantage with this is that you don't have to include the Websphere client jar files in you classpath.

So what is the service URL? This is specific to the server. Using the Sun connector library only allows you to not need the WAS client library, you still need to know the service URL. You need to search for the service URL on the IBM site.

BTW, there is no guarantee that it is supported. For example, the service URL to JBoss only works for 5.0. There is no way to use a service URL to the RMI connector for JBoss 4.x... so this route may be a dead end.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18840
    
  40


1.Does that mean that since soap connector uses port 8880 then if i switch to RMICOnnector , it will also use the same port?

2.if not,then how can i find out that which port is used by rmi connector?


Since I did some research on question 2, awhile back...

For the most part, there is *no* way to figure out the port number used by the RMI connector from the service URL, or from the connector itself.

The service URL specifies the JNDI port, along with the name used in the JNDI service. It doesn't specify the RMI connector port. In fact, I believe that the RMI connector probably uses a port allocated at creation time, which could be anything. Not that it really matters, with the JNDI port, and naming, specified in the service URL, it will return you a proxy to the RMI connector, which is rightly configured to know which port to connect to.

There is also no way to figure out what the port number is, from the RMI connector object that is returned. Not that it really matters, because once you have the connector object, you can establish a connection to the mbean server just by using the object.

Henry
Akhil Jain
Ranch Hand

Joined: Oct 14, 2004
Posts: 74
thanks for all your replies.
But my question still remains there.

ok.forget about RMIConnector.
how can i use SOAPConnector using sun jars and not IBM jars to connect to WAS Mbean from SUN CLient?

any example code will help a lott.

thanks
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18840
    
  40

Originally posted by Akhil Jain:
thanks for all your replies.
But my question still remains there.

ok.forget about RMIConnector.
how can i use SOAPConnector using sun jars and not IBM jars to connect to WAS Mbean from SUN CLient?

any example code will help a lott.

thanks


This is *not* an answer to your question... sorry...

I have never gotten the standard JMX jars to work with a service URL that wasn't the JMXMP connector or the RMI connector. It always either reported a protocol error, or some exception related to classes. I always had to use client specific jars for other protocols.

Henry
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18840
    
  40

As I already mentioned, most of my JMX experience are related to the Weblogic and JBoss app servers -- including much work related to the Sun Reference Implementation, and MX4J... I have limited experience with Websphere, so please take this with a grain of salt.

Anyway, I just did a search on the IBM site for a JMX service url example and found this. This seems to be a large example that uses the MX4J client libraries to get to the Websphere application server. The MX4J implementation should be similar to the Sun reference implementation, and should use the same service URL. (You also need to ignore the Spring stuff)

Anyway... near the end of the page, the service URL that was used was...



I guess you still need to adjust it for your host -- the example uses the localhost. And your JNDI port. (Note: in the example, 8999 is the JNDI port -- not the RMI port)

[EDIT: I was wondering why this service url looked so familar. I encountered this before when I was using Tomcat. Basically, if Tomcat is configured to run with Java 5.0, Tomcat can be configured to use the default mbean server included in the Java 5.0 JVM.

To get to that mbean server externally, that was the service url that I used. Something tells me that this example is for Websphere configured for Java 5.0, using the default mbean server. In any case, try it... and let me know if it works.]

Hope this helps,
Henry
[ April 13, 2006: Message edited by: Henry Wong ]
Akhil Jain
Ranch Hand

Joined: Oct 14, 2004
Posts: 74
I am getting this exception:


serviceUrl:---> service:jmx:rmi:///jndi/rmi://20.20.83.251:8999/jmxrmi

java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 20.20.83.251; nested exception is:
java.net.ConnectException: Connection refused: connect]
at javax.management.remote.rmi.RMIConnector.connect(Unknown Source)
at javax.management.remote.JMXConnectorFactory.connect(Unknown Source)
at javax.management.remote.JMXConnectorFactory.connect(Unknown Source)
at com.jmx.JBossClient.connect(JBossClient.java:44)
at com.jmx.JBossClient.main(JBossClient.java:100)
Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 20.20.83.251; nested exception is:
java.net.ConnectException: Connection refused: connect]
at com.sun.jndi.rmi.registry.RegistryContext.lookup(Unknown Source)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(Unknown Source)
at javax.management.remote.rmi.RMIConnector.findRMIServer(Unknown Source)
... 5 more
Caused by: java.rmi.ConnectException: Connection refused to host: 20.20.83.251; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
... 10 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
... 15 more
Akhil Jain
Ranch Hand

Joined: Oct 14, 2004
Posts: 74
i changed Administrative Service in WAS 6.0 to use RMIConnector and now i am giving the port as 8880 (which was earlier set for SOAPConnector) and i am getting this exception now:

service:jmx:rmi:///jndi/rmi://20.20.83.251:8880/jmxrmi
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: non-JRMP server at remote endpoint]
at javax.management.remote.rmi.RMIConnector.connect(Unknown Source)
at javax.management.remote.JMXConnectorFactory.connect(Unknown Source)
at javax.management.remote.JMXConnectorFactory.connect(Unknown Source)
at com.jmx.JBossClient.connect(JBossClient.java:44)
at com.jmx.JBossClient.main(JBossClient.java:100)
Caused by: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: non-JRMP server at remote endpoint]
at com.sun.jndi.rmi.registry.RegistryContext.lookup(Unknown Source)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(Unknown Source)
at javax.management.remote.rmi.RMIConnector.findRMIServer(Unknown Source)
... 5 more
Caused by: java.rmi.ConnectIOException: non-JRMP server at remote endpoint
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
... 10 more
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JMX Conenctor setting in WAS 6.0