Connecting to Virgo via JMX

$ cd $VIRGO_HOME
$ bin/startup.sh -jmxport 9090

As documented in Accessing Gemini Management MBeans from a Groovy Script it's rather easy to get in touch with the JMX console of Virgo (e.g. with Groovy):

System.getProperties().put("javax.net.ssl.trustStore", System.getenv("VIRGO_HOME") + "/configuration/keystore");
def client = new JmxBuilder().connectorClient(port: 9875)

print "connecting to JMX server..."
client.connect([ 'jmx.remote.credentials' :  ['admin', 'admin' ] as String[] ])
println "established."

MBeanServerConnection server = client.getMBeanServerConnection()

Once you have a server connection established you've got cool options like deploying your own bundle myBundle.jar. Grab the deployer MBean named org.eclipse.virgo.kernel:category=Control,type=Deployer and invoke the deploy command:

static String DEPLOYER_MBEAN_NAME = "org.eclipse.virgo.kernel:category=Control,type=Deployer"

ObjectName deployer = new ObjectName(DEPLOYER_MBEAN_NAME);
File deploymentUri = new File("/tmp/myBundle.jar")
server.invoke(deployer, "deploy", [deploymentUri.toURI().toString() ] as Object[], [String.class.getName() ] as String[])
Show Comments