[jboss-dev-forums] [JMX Development] - Trying to connect to an JBoss 4.2.1.GA org.jboss.system.server.ServerInfo with groovy without success results in "error during JRMP connection establishment"
Andreas Oswald
do-not-reply at jboss.com
Wed Jun 8 16:36:04 EDT 2011
Andreas Oswald [http://community.jboss.org/people/cptblaubaer] created the discussion
"Trying to connect to an JBoss 4.2.1.GA org.jboss.system.server.ServerInfo with groovy without success results in "error during JRMP connection establishment""
To view the discussion, visit: http://community.jboss.org/message/609267#609267
--------------------------------------------------------------
Hi there,
to monitor FreeMemory in org.jboss.system.server.ServerInfo on a regular basis I would like to connect to 4.2.1.GA with the help of a groovy script and execute some actions in the groovy script if the FreeMemory goes under a critical value. Also I would like to log the FreeMemory over the time, which could be done in the groovy script as well.
When using the jmx console with the browser I can show the wanted value as can be done with executing twiddle.
> Accessing from twiddle works fine
>
>
> C:\Programme\jboss-4.2.1.GA\bin>twiddle -s vm-appsfs4p:1099 get "jboss.system:type=ServerInfo" FreeMemory
> FreeMemory=320676872
>
I tried quite a few code snippets from the internet and tried different permutation of URL syntax
import java.lang.management.*
import javax.management.ObjectName
import javax.management.remote.JMXConnectorFactory as JmxFactory
import javax.management.remote.JMXServiceURL as JmxUrl
def serverUrl = "service:jmx:rmi:///jndi/rmi://vm-appsfs4p:1099/jmxrmi"
String beanName = "jboss.system:type=ServerInfo"
def server = JmxFactory.connect(new JmxUrl(serverUrl)).MBeanServerConnection
def mbean = new GroovyMBean(server, beanName)
println "Connected to:\n$dataSystem\n"
println mbean.FreeMemory;
> Here's what my output looks like
>
>
> C:\temp>jmx.groovy
>
> Caught: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.CommunicationException
> [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
> java.net.SocketException: Software caused connection abort: recv failed]
> at jmx.run(jmx.groovy:9)
>
What am I doing wrong? Please be kind as those are my first experiments in this area.
I'd be happy if someone could help me with this, thanks in advance for your help
Take care
Andreas
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/609267#609267]
Start a new discussion in JMX Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2105]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20110608/5f8db3fa/attachment.html
More information about the jboss-dev-forums
mailing list