how to create groovy client? getting an error, below.


start up jboss with following paremater:
set JAVA_OPTS= -Djava.rmi.server.hostname=localhost
               -Dcom.sun.management.jmxremote.ssl=false
               -Dcom.sun.management.jmxremote.authenticate=true
               -Dcom.sun.management.jmxremote.password.file=C:\Java\jdk1.7.0\jre\lib\management\jmxremote.password
               -Dcom.sun.management.jmxremote.access.file=C:\Java\jdk1.7.0\jre\lib\management\jmxremote.access"



test jboss is started:
http://localhost:9990/
username: abc
password: abc1#



Groovy script:
import javax.management.ObjectName
import javax.management.remote.JMXConnectorFactory as JmxFactory
import javax.management.remote.JMXServiceURL as JmxUrl
import groovy.swing.SwingBuilder
import javax.swing.WindowConstants as WC
 
 
// Connect to server
def serverUrl = 'service:jmx:rmi:///jndi/rmi://localhost:9990/jmxrmi'
def server = JmxFactory.connect(new JmxUrl(serverUrl)).MBeanServerConnection
def serverInfo = new GroovyMBean(server, 'Catalina:type=Server').serverInfo
println "Connected to: $serverInfo"







Error:

Exception thrown
 
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.SocketTimeoutException: Read timed out]
    at jmxClient.run(jmxClient.groovy:10)
 
Caused by: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
    java.net.SocketTimeoutException: Read timed out]
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:118)
    at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:203)
    ... 1 more
 
Caused by: java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
    java.net.SocketTimeoutException: Read timed out
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:114)
    ... 2 more
 
 
Caused by: java.net.SocketTimeoutException: Read timed out
    ... 3 more