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

Jason T. Greene jason.greene at redhat.com
Thu Mar 25 19:30:29 EDT 2010


I took a look at this and jconsole uses a jndi wrapper to talk to an rmi 
registry. So, the key to doing name based urls, which jconsole can 
understand without a custom plugin, is to register the 
JMXConnectorServer in an rmi registry. The JDK jndi wrapper can't be 
used though since it is not portable. This means either using the 
RMIServerImpl directly to get the stub and put it in the registry, or 
alternatively writing a simple fake jndi initial context factory that 
delegates to an rmi registry. It should also be possible to write a 
custom authentication plugin that will work with JAAS that jconsole also 
knows about. In the future if this is moved to remoting, it will need a 
custom plugin.

Jason T. Greene wrote:
> Ah ok. I had it in my head that jconsole used some kind of fake 
> representation of jndi.
> 
> David M. Lloyd wrote:
>> The problem is that in order to use the JSR160 RMI transport, you have to 
>> get the stub to the client.  You can either do this by URL (which means 
>> that the client has to have the whole insanely long URL 
>> ["service:jmx:rmi://[host[:port]]/stub/really-long-base64-encoded-stub"] in 
>> order to connect, thus making automated connection impossible), or by 
>> binding the stub into JNDI and using a JNDI URL 
>> ["service:jmx:rmi://[host[:port]]/jndi/jndi-name"].  The latter is roughly 
>> what we do today with RMIAdaptor (sic), so it seems the least invasive to 
>> me since one would think that things like Twiddle would then only have to 
>> change the interface of what they pull out of JNDI.
>>
>> On 03/25/2010 01:26 PM, Jason T. Greene wrote:
>>> Or you could just create a simple bean to represent the remote JMX
>>> service, and have it construct the remote JMX objects and jndi entries
>>> as part of start/stop.
>>>
>>> Although this makes me wonder what cases we have where you need to pull
>>> a remote jmx reference from jndi? If this is locally running code the
>>> current mbeanserver is all you need. So I am guessing there is some
>>> ha-jndi case you are trying to support?
>>>
>>> David M. Lloyd wrote:
>>>> Also maybe the @org.jboss.aop.microcontainer.aspects.jndi.JndiBinding
>>>> annotation might do this another way?
>>>>
>>>> Either way it would be nicer if you could do:
>>>>
>>>>       <jndi-binding bean="TheBean" name="the/name/in/JNDI"/>
>>>>
>>>> or something like that.
>>>>
>>>> On 03/25/2010 01:12 PM, Ron Sigal wrote:
>>>>> jboss-as-testsuite/src/main/org/jboss/test/naming/restart/ObjectBinder.java
>>>>> binds a particular kind of object into jndi.  See
>>>>> jboss-as-testsuite/src/resources/naming/restart/naming-restart-jboss-beans.xml:
>>>>>
>>>>>
>>>>>      <bean name="RestartObjectBinder"
>>>>> class="org.jboss.test.naming.restart.ObjectBinder">
>>>>>         <property name="namingService"><inject
>>>>> bean="RestartNamingService"/></property>
>>>>>      </bean>
>>>>>
>>>>> It could be generalized.
>>>>>
>>>>> -Ron
>>>>>
>>>>> 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.  :)
>>>>>>
>>>>>> Thanks,
>>>>>> Scott
>>>>>>
>>>>>> _______________________________________________
>>>>>> jboss-development mailing list
>>>>>> jboss-development at lists.jboss.org
>>>>>> https://lists.jboss.org/mailman/listinfo/jboss-development
>>>>>>
>>>>> _______________________________________________
>>>>> jboss-development mailing list
>>>>> jboss-development at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/jboss-development
> 
> 


-- 
Jason T. Greene
JBoss, a division of Red Hat



More information about the jboss-development mailing list