PDA

View Full Version : JMX Mbean - setting absolute serviceUrl



geirgp
Aug 18th, 2006, 02:31 AM
I am using Spring to export my MBeans through JMX using org.springframework.jmx.support.ConnectorServerFac toryBean and org.springframework.jmx.export.MBeanExporter.

I've configured the ConnectorServerFactoryBean with the following serviceUrl:
<property name="serviceUrl" value="service:jmx:iiop://localhost:5544" />

However Spring seems to add some more to this url, and this something is pretty much random. When I look it up in JBoss' JMX console the serviceUrl is as follows:
service:jmx:iiop://localhost:5544/ior/IOR:000000000000003b524d493a6a617661782e6d616e6167 656d656e742e72656d6f74652e726d692e524d495365727665 723a3030303030303030303030303030303000000000000100 00000000000095000102000000000d3137322e32352e31312e 323800000e9000000019afabcb00000000021c4c69bc000000 08000000000000000014000000000000030000000100000020 00000000000100010000000205010001000100200001010900 00000100010100000000260000000200020000000000190000 001d0000000000000015687474703a2f2f6f736c2d3232363a 383038332f00

Is there a way i can change this "ior/IOR:000...." to something non-random so I don't have to look it up and change my client's serviceUrl everytime i restart my application? Or is there perhaps a way to identify this serviceUrl?

Thanks,

Geir

Costin Leau
Aug 18th, 2006, 05:28 AM
Hmm - I'm not so sure is Spring and not the underlying IOR server/jmx implementation. Have you tried using something else then ior, for example RMI?

geirgp
Aug 18th, 2006, 05:44 AM
Thanks for replying so quickly.

I have tried using RMI and that gave the same result (with minor differences: "stub" instead of "ior" and an ASCII identifier instead of HEX):

service:jmx:rmi://localhost:5544/stub/rO0ABXNyAC5qYXZheC5tYW5hZ2VtZW50LnJlbW90ZS5ybWkuUk 1JU2VydmVySW1wbF9TdHViAAAAAAAAAAICAAB4cgAaamF2YS5y bWkuc2VydmVyLlJlbW90ZVN0dWLp/tzJi+FlGgIAAHhyABxqYXZhLnJtaS5zZXJ2ZXIuUmVtb3RlT2J qZWN002G0kQxhMx4DAAB4cHc3AAtVbmljYXN0UmVmMgAADDE3M i4yNS4xMS4yOAAAFagAAAAAAAAAArBYvPsAAAENINmEZYAAAHg =

this is my config:


<bean id="serverConnector" class="org.springframework.jmx.support.ConnectorServerFac toryBean" lazy-init="false" depends-on="registry">

<property name="serviceUrl" value="service:jmx:rmi://localhost:5544" />

<property name="objectName">
<value>connector:name=rmi</value>
</property>
<property name="threaded">
<value>true</value>
</property>
<property name="daemon">
<value>true</value>
</property>



</bean>

<bean id="registry" class="org.springframework.remoting.rmi.RmiRegistryFactor yBean">
<property name="port" value="5544"/>
</bean>
<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false" depends-on="serverConnector">
<property name="beans">
<map>
<entry key="bean:name=driftsmeldingBean" value-ref="DriftsMeldingerBO" />
</map>
</property>
<property name="server">
<bean class="org.jboss.mx.util.MBeanServerLocator" factory-method="locateJBoss" />
</property>

</bean>


edit: typo

Costin Leau
Aug 18th, 2006, 06:05 AM
Have you tried the JBoss forums - the random is basically a unique identified for the service but I don't understand who generates it and if it's used along with the name or just by the underlying server (RMI or IIOP).
I haven't used this scenario but I recommend you take a look at the JMX spec - it might be that using the first service url and the object name the server does the appropriate matching.
Try also looking at mx4j - last time I checked jboss jmx (at least on 3.2.x) was not fully 1.2 compatible.