Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MC4J and TOMCAT 5.5+

Status
Not open for further replies.

tony17

Programmer
May 11, 2004
10
IT
I downloaded and istalled both tomcat 5.5.4 and mc4j 1.2 beta7.
I modified catalina.sh as specified in that is
setting JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=9004". Next I tried to connect mc4j to the tomcat instance with default parameters

Initial context factory = com.sun.jndi.rmi.registry.RegistryContextFactory
Server URL = service:jmx:rmi:///jndi/rmi://localhost:9004/jmxrmi

but it doesn't connect!

Can somebody help me?

tony.
 
of course:

java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused]
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:317)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:247)
at org.mc4j.console.connection.JSR160ConnectionNode.connect(JSR160ConnectionNode.java:106)
at org.mc4j.console.ConnectAction.performAction(ConnectAction.java:76)
at org.openide.util.actions.NodeAction$3.run(NodeAction.java:440)
at org.openide.util.actions.CallableSystemAction$ActionRunnable.actionPerformed(CallableSystemAction.java:247)
at org.netbeans.core.ModuleActions.invokeAction(ModuleActions.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.openide.util.actions.CallableSystemAction.invokeAction(CallableSystemAction.java:179)
at org.openide.util.actions.CallableSystemAction.access$000(CallableSystemAction.java:31)
at org.openide.util.actions.CallableSystemAction$ActionRunnable.doRun(CallableSystemAction.java:241)
at org.openide.util.actions.CallableSystemAction$2.run(CallableSystemAction.java:111)
at org.openide.util.Task.run(Task.java:136)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:330)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:686)
Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused]
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:92)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:185)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1785)
at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1751)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:259)
... 17 more
Caused by: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:88)
... 22 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at java.net.Socket.<init>(Socket.java:309)
at java.net.Socket.<init>(Socket.java:124)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
[catch] ... 27 more

A question:
Should I set something else in tomcat?
 
Looks like whatever you think is listening is not ... can you do :

"telnet localhost 9004" successfully ?

--------------------------------------------------
Free Database Connection Pooling Software
 
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused :-(

I tried also on other ports different from 9004 but with the same results...
 
Well if you cannot telnet to localhost port 9004 (ie the port you are interested in contacting the JMX connector on), then your Java app will never work. You need to find out why the JMX connector you wish to bind on 9004 is not doing so.

What does "netstat -a |grep 9004" give you (on a linux machine - if on Win32, just try a netstat and manually eliminate the ports).

--------------------------------------------------
Free Database Connection Pooling Software
 
Nothing.
Port 9004 doesn't appears anywhere after "netstat -a".
Should I modify the original server.xml? (I haven't modified server.xml anyway)
JAVA_OPTS="$JAVA_OPTS Dcom.sun.management.jmxremote.port=9004" needs to be collocated in a particular place inside catalina.sh?

 
What SDK & JRE are you using ? You can only utilise this option in tomcat 5.5 if you are running 1.5 ...

--------------------------------------------------
Free Database Connection Pooling Software
 
I had 1.4.2 and now I have jdk 1.5....but it doesn't work. I have this error when I try to connect MC4j to tomcat5.5:

java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: javax.rmi.ssl.SslRMIClientSocketFactory]
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:317)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:247)
at org.mc4j.console.connection.JSR160ConnectionNode.connect(JSR160ConnectionNode.java:106)
at org.mc4j.console.ConnectAction.performAction(ConnectAction.java:76)
at org.openide.util.actions.NodeAction$3.run(NodeAction.java:440)
at org.openide.util.actions.CallableSystemAction$ActionRunnable.actionPerformed(CallableSystemAction.java:247)
at org.netbeans.core.ModuleActions.invokeAction(ModuleActions.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.openide.util.actions.CallableSystemAction.invokeAction(CallableSystemAction.java:179)
at org.openide.util.actions.CallableSystemAction.access$000(CallableSystemAction.java:31)
at org.openide.util.actions.CallableSystemAction$ActionRunnable.doRun(CallableSystemAction.java:241)
at org.openide.util.actions.CallableSystemAction$2.run(CallableSystemAction.java:111)
at org.openide.util.Task.run(Task.java:136)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:330)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:686)
Caused by: javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: javax.rmi.ssl.SslRMIClientSocketFactory]
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:92)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:185)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1785)
at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1751)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:259)
... 17 more
Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: javax.rmi.ssl.SslRMIClientSocketFactory
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:88)
... 22 more
Caused by: java.lang.ClassNotFoundException: javax.rmi.ssl.SslRMIClientSocketFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:430)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:631)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:200)
at java.io_ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1513)
at java.io_ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
at java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io_ObjectInputStream.readObject(ObjectInputStream.java:324)
at sun.rmi.transport.tcp.TCPEndpoint.read(TCPEndpoint.java:504)
at sun.rmi.transport.LiveRef.read(LiveRef.java:254)
at sun.rmi.server.UnicastRef2.readExternal(UnicastRef2.java:54)
at java.rmi.server.RemoteObject.readObject(RemoteObject.java:420)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at java.io_ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:838)
at java.io_ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
at java.io_ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
at java.io_ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io_ObjectInputStream.readObject(ObjectInputStream.java:324)
[catch] ... 24 more

telnet now works on port 9004 but i don't undestand this kind of error...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top