[jboss-dev] How to bind object to JNDI from jmx-jboss-beans.xml

Adrian Brock abrock at redhat.com
Thu Mar 25 14:14:29 EDT 2010


On Thu, 2010-03-25 at 13:44 -0400, Scott Marlow wrote:
> I'm working on adding a remote JMXConnector to AS trunk via a new
> jmx-jboss-beans.xml (see http://pastebin.com/JjsiRrh9).  I would like to
> bind a string representation of the JMX service URL to JNDI.  Any
> pointers to doing the bind (from a jboss-beans.xml) are welcome.
> 
> If not, I will hack through it but wanted to check first.  :)
> 

Why don't you just bind the JMXServiceURL, it is Serializable.

There's a prototype in the naming project that would let you
do it with an annotation:
https://svn.jboss.org/repos/jbossas/projects/naming/trunk/naming-mc-int/src/test/resources/org/jboss/test/naming/microcontainer/binding/test/Plain.xml

But I don't think it has been integrated into JBossAS?

The other alternative is to use an install/uninstall
to rebind/unbind on the InitialContext.

e.g.

  <bean name="InitialContext" class="javax.naming.InitialContext"/>
 
  <bean name="JMXServiceURLParameter"
class="javax.management.remote.JMXServiceURL">
      <constructor>
          <!--  
              The following will auto generate a RMIJRMPServerImpl and
the stub will look like:
              service:jmx:rmi://host:port/stub/XXXX (which can be passed
to)
          -->

<parameter>service:jmx:rmi://${jboss.bind.address:localhost}:1102</parameter>
      </constructor>

<!-- HERE -->

      <install bean="InitialContext" method="rebind">
         <parameter>placeToBind</parameter>
         <parameter><this/></parameter>
      </install>
      <uninstall bean="InitialContext" method="unbind">
         <parameter>placeToBind</parameter>
      </uninstall>
  </bean>


> Thanks,
> Scott
> 
> _______________________________________________
> jboss-development mailing list
> jboss-development at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-development

-- 
xxxxxxxxxxxxxxxxxxxxx
Adrian Brock
Chief Scientist
JBoss by Redhat
xxxxxxxxxxxxxxxxxxxxx




More information about the jboss-development mailing list