Hi,
I am new to Spring, and I have a problem of using jmx. I am using "Spring in action" book, and I try to follow tre steps, but I have a lost (it's not enough for me to understand what a writer intend to say ). However, it is not funny so much because I am trying whole day to understand thing! I use m4cj but when it try to connect to Tomcat I get following error:
[code]
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: connect]
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:323)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
at org.mc4j.console.connection.JSR160ConnectionNode.connect(JSR160ConnectionNode.java:132)
at org.mc4j.console.connection.ReconnectAction.performAction(ReconnectAction.java:47)
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:597)
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: connect]
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:101)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:185)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1871)
at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1841)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:257)
... 17 more
Caused by: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:97)
... 22 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:180)
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:595)
[catch] ... 27 more
[code]
Is this familiar to you?
Well, even it it was working I still can get it. I have also consult Spring source (turorial), but I didn't get it. Where should I see such a stuff (I believe it is like running jmx-console in JBoss, but wher to see)???
How should I deploy my spring beans to be MBean ( I am using eclipse, and there are saying in one of books using command-prompt issues), how to engage MBeanExporter? and so on....
I would reaaaaaaaaaally appreciate if someone could plainly explain to me steps of JMX usage.
Thanksssss in advance!!!
Are you using JBoss? Something you said at the end is making me think you are, and this
Caused by: java.net.ConnectException: Connection refused: connect
Is making me think you need to use the username password that is set in JBoss for JMX console.
Am I correct to assume this?
Mark
p.s. I might not be able to reply quickly as this weekend is a holiday weekend and I have lot of plans. Sorry
Hi. No it is not JBoss ( I was just making comparison about my conceiving about jmx usage, when I have speak about JBoss).
I use Tomcat. I start tomcat, and then activate MC4J console and get mentioned error. But can you explain to me logic and steps need to jmx usage? Just as I said, I do not figure out enough about that issu.
Thanks!
Goran Markovic
Ranch Hand
Joined: Sep 26, 2008
Posts: 399
posted
0
I believe that resource I had referred to, are quite incomplete for understanding of how JMX work, for someone with no previously experience about itself...
It looks like you are trying to get to the MBean server via the RMI connector -- and either... the RMI connector is not installed, or it has been configured to listen to a different port than the one that you are using. I believe, by default, no connectors are configured in Tomcat (although it has been a while), as most components gets to the MBean server via JNDI instead.
Ok. probably many reasons might be. But can I avoid reading of "JMX in Action", and someone provide me with step-by-step tutorial with simple example, just to figure out whole picture about JMX.
Thanks in advance!
Good Luck. It really is pretty simple. The thing you have to know here is if you have the JMX/MBeanServer have a user/password. I am also assuming here that all you want is the client side, connecting your code to an MBeanServer and figuring out the MBeans that are out htere and what they have available. More than wanting to create a simple POJO MBean.