-
1. Re: remote JMX call from within JBoss
dlofthouse Feb 29, 2012 10:42 AM (in response to peterfry)Can you try adding a dependency on the "org.jboss.remoting3.remoting-jmx" module - this is where the provider implementation lives.
-
2. Re: remote JMX call from within JBoss
peterfry Feb 29, 2012 11:00 AM (in response to dlofthouse)Still says, errors with the same stack trace.
-
3. Re: remote JMX call from within JBoss
dlofthouse Feb 29, 2012 11:16 AM (in response to peterfry)Ok, I will try this with something else I am looking at regarding JMX.
One quick question, is there a reason you need a remote connection to JMX? Is this to connect to a remote server or the local server?
-
4. Re: remote JMX call from within JBoss
peterfry Feb 29, 2012 11:20 AM (in response to dlofthouse)Essentially I have remote and local (within jboss) clients that can send messages to queues and I don't want to allow them to do so until those queues are available.
The code that we previously used in Jboss 5.0.1 is
JMXServiceURL serviceURL = new JMXServiceURL(urlString);
JMXConnector jmxConnector = JMXConnectorFactory.connect(serviceURL, null);
MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();
ObjectName name = ObjectName.getInstance("jboss.system", "type", "Server");
Boolean started = (Boolean) connection.getAttribute(name, "Started"); -
5. Re: remote JMX call from within JBoss
peterfry Feb 29, 2012 11:59 AM (in response to peterfry)I said that the remote client seemed to be connecting but in fact I am getting
java.lang.RuntimeException: Operation failed with status WAITING
at org.jboss.remoting3.jmx.RemotingConnector.connect(RemotingConnector.java:173)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)This remote client has a classpath which has the new jboss-client-7.1.0.Final.jar on it as well as a jboss-ejb-client.properties file and is able to make remote ejb calls via the ejb: protocol.
-
6. Re: remote JMX call from within JBoss
dlofthouse Feb 29, 2012 12:12 PM (in response to peterfry)1 of 1 people found this helpfulin-vm you would probably be better to just access the MBeanServer directly and save any network overhead.
For the remote client which port are you trying to connect to? Do you get any errors on the server?
-
7. Re: remote JMX call from within JBoss
peterfry Mar 1, 2012 4:50 AM (in response to dlofthouse)My remote jmx connection now works (confusion on my part between the remoting port and the management native port.
Some comments though:
1) I can't get jconsole to connect (I noticed someone else raising this, I'm guessing if you are going to jboss remoting rather than rmi then you will need that on the jconsole classpath?)
2) jmxConnector.close() doesn't seem to do anything (trying out the simple java app in the JBoss AS 7.1 documentation on JMX hangs and when I kill it I get warning messages in JBoss - this was from eclipse so maybe something funny going on there).
Lastly but most importantly can you give any guidance to what bean to use instead of the bean used in the following which worked for Jboss 5.0.1
ObjectName name = ObjectName.getInstance("jboss.system", "type", "Server");
Boolean started = (Boolean) connection.getAttribute(name, "Started");Bit worried about the the jmxConnecter.close()! UPDATE - I definitely have loads of connections being left around and get lots of
2012-03-01 09:43:12,288 ERROR - JBREM000200: Remote connection failed: java.io.IOException: An existing connection was forcibly closed by the remote host (org.jboss.remoting.remote.connection)
being reported in the client after I stop JBoss.
Thanks,
Peter.
-
8. Re: remote JMX call from within JBoss
dlofthouse Mar 1, 2012 7:21 AM (in response to peterfry)1 of 1 people found this helpful1) I can't get jconsole to connect (I noticed someone else raising this, I'm guessing if you are going to jboss remoting rather than rmi then you will need that on the jconsole classpath?)
Yes jconsole does need the correct classpath to be set so that the remoting-jmx libraries can be found, within the bin folder of the AS7 distributions there is now a pair of jconsole scripts that set up the classpath as required before starting jconsole.
2) jmxConnector.close() doesn't seem to do anything (trying out the simple java app in the JBoss AS 7.1 documentation on JMX hangs and when I kill it I get warning messages in JBoss - this was from eclipse so maybe something funny going on there).
The close call does shut down the Remoting connection but there was also an ExecutorService left running which was causing some client issues which has been resolved under the following issue: -
https://issues.jboss.org/browse/REMJMX-34
If you still get close errors a test case to reproduce would be appreciated so we can try and run it locally.
Regarding the available MBeans I am going to need to let someone else follow up on that one as I have been more involved in the communications protocol rather than the beans themselves.
-
9. Re: remote JMX call from within JBoss
peterfry Mar 1, 2012 8:22 AM (in response to dlofthouse)Thanks, I hadn't noticed the jconsole scripts in the jboss as 7.1 bin directory, able to connect fine now.
REMJMX-34 suggests that the daeomon threads die after 60 seconds so I will see if this is indeed the case, if so it is something we can tolerate.
UPDATE: the threads are not dying after 60 seconds I have uploaded a test case.
Thanks,
Peter.
Message was edited by: Peter Fry
-
JMXExample.java.zip 688 bytes
-
-
10. Re: remote JMX call from within JBoss
peterfry Mar 2, 2012 6:19 AM (in response to peterfry)Is there any recommendation regarding REMJMX-34 ? The issue log indicates it is fixed, should I try and get a jar and drop it into my JBoss AS 7.1 installation (though preumably I'll have to update the bundled client jar ?
-
11. Re: remote JMX call from within JBoss
dlofthouse Mar 2, 2012 6:45 AM (in response to peterfry)You will not be able to drop it in on the server side as there are some changes to the classes referenced by AS7 - on the client side however the protocol is exactly the same so you may be able to replace the version on the client.
-
12. Re: remote JMX call from within JBoss
peterfry Mar 19, 2012 5:04 PM (in response to dlofthouse)I've tried the following code for querying the jmx server from WITHIN JBoss (in fact from a servlet that is being deployed, I make the servlet dependent on the 'org.jboss.as.jmx' module)
connection = MBeanServerFactory.newMBeanServer();
ObjectName serviceRef = new ObjectName("*.*:*");
Set<ObjectName> mbeans = connection.queryNames(serviceRef, null);
for (ObjectName on : mbeans)
{System.out.println("\t ObjectName : " + on);
}But it doest list any MBeans. Is this the right way to get a local connection to the Jboss 7.1 JMX server to query MBeans?
-
13. Re: remote JMX call from within JBoss
dimitris Mar 19, 2012 5:06 PM (in response to peterfry)Get the platformMBeanServer instead of creating a new one.
-
14. Re: remote JMX call from within JBoss
peterfry Mar 19, 2012 5:19 PM (in response to dimitris)OK this is a dumb question - how do you get the platform MBeanServer from within a JBoss AS 7.1 deployment unit (such as a servlet). Would appreciate a code snippet.
Thanks,
Peter.
UPDATE:
Do you mean:
ManagementFactory.getPlatformMBeanServer();