Configuring remote JMX with jboss-client.jar
thebravedave May 18, 2012 3:21 PMHello, Im having a bit of a problem getting remote JMX working with Jboss-7.1.0.Final.
I know that there is a different way of making the remote JMX call as such:
service:jmx:remoting-jmx://" + serveName + ":9999
I also know that you have to add jboss-client-7.1.0.Final to the classpath of the project that is acting as the client and making the remote JMX call.
I created a little experimental project in my IDE (IntelliJ) using Grails. I added jboss-client-7.1.0.Final directly to my Grails's lib folder. When I run the
project directly from my IDE, the project works, and I can make the remote JMX call.
When I package the project as a war and deploy to my local Jboss 7.1.0.Final server I get these errors.
11:41:34,012 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-13) Context initialization fail
ed: org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is org.cod
ehaus.groovy.runtime.InvokerInvocationException: java.io.IOException: Unable to load configuration class org.jboss.logma
nager.PropertyConfigurator
at org.codehaus.groovy.grails.web.context.GrailsContextLoader.createWebApplicationContext(GrailsContextLoader.ja
va:87) [grails-web-1.3.7.jar:1.3.7]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) [spring-web-3
.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [spri
ng-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.10.Fin
al.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.10.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.0.Fina
l.jar:7.1.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]
Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: java.io.IOException: Unable to load configuration cla
ss org.jboss.logmanager.PropertyConfigurator
at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:723) [grails-spring-1.3.7.jar:1.3.7]
at grails.spring.BeanBuilder.beans(BeanBuilder.java:573) [grails-spring-1.3.7.jar:1.3.7]
at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:519) [grails-spring-1.3.7.jar:1.3.7]
... 6 more
Caused by: java.io.IOException: Unable to load configuration class org.jboss.logmanager.PropertyConfigurator
at org.jboss.logmanager.LogManager.construct(LogManager.java:266) [jboss-client-7.1.0.Final.jar:7.1.0.Final]
at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:244) [jboss-client-7.1.0.Final.jar:7.1.0.Fi
nal]
at org.jboss.logmanager.LogManager$readConfiguration.call(Unknown Source) [:1.2.2.GA]
... 9 more
Caused by: java.lang.ClassCastException: Cannot cast org.jboss.logmanager.PropertyConfigurator to org.jboss.logmanager.C
onfigurator
at java.lang.Class.cast(Class.java:3005) [rt.jar:1.7.0]
at org.jboss.logmanager.LogManager.construct(LogManager.java:264) [jboss-client-7.1.0.Final.jar:7.1.0.Final]
... 11 more
So obviously there are errors when I try and package it directly with the grails war.
I was looking for different ways to add the jboss-client jar to the classpath and I read this article about JMX with Jboss 7.1.0
https://docs.jboss.org/author/display/AS71/JMX+subsystem+configuration
In that article they say you can set jboss-client.jar in the classpath as such:
!/bin/bash
# specify your AS7 folder
export YOUR_AS7_HOME=~/as7java -classpath $YOUR_AS7_HOME/bin/client/jboss-client.jar:./ JMXExample
Locally, I'm running on Windows, although when I deploy to my companies server's it will be in a Linux environment
I really wasn't sure about this java -classpath $YOUR_AS7_HOME/bin/client/jboss-client.jar:./ JMXExample Line.
I know that my jboss-client-7.1.0.Final jar is located in as7home/bin/client, but the rest confuses me. My class in the war is called SogoXmlController.groovy.
How would I reference this in the line above?
I removed jboss-client-7.1.0.Final from the Grails war's lib folder and tried adding this to my standalone.conf.bat file :
set java -classpath /bin/client/jboss-client-7.1.0.Final.jar:./ SogoXmlController
But this didn't work because when I tried to make the JMX call I got the error:
java.net.MalformedURLException: Unsupported protocol: remoting-jmx
which is the standard error when jboss-client jar is not added to your classpath.
Even if I got something like
set java -classpath /bin/client/jboss-client-7.1.0.Final.jar:./ SogoXmlController
working (like I just needed to change the classpath setting a tab bit)
I still have other classes that make seperate remote JMX calls.Would I have multiple of these "java -classpath" s added to my standalone.conf (or for windows standalone.conf.bat)? Wouldnt they overwrite each other?
I would love to just be able to add jboss-client-7.1.0.Final to my Grail's lib folder and be done with it (like I did when I ran it from my IDE directly), but I get those
java.io.IOException and java.lang.ClassCastException
exceptions.
Please help me.
Sincerely,
David Matthew Pugglesworth