You need to use a connector.
I think these docs are 2.4
and there is a mistake which is corrected in these
forums if you search.
If you are using 3.0 there is also an ejb connector.
The idea behind these are that you lookup a "remote
MBeanServer" from jndi, then you can access the MBean
using that object.
The only connection between jndi and jmx is that jndi services in jboss are implemented as mbeans. If you want something related to your mbean to be bound in jndi you have to bind it yourself. Consider using the NonSerializableObjectFactory so you get your original mbean back, not a serialized/deserialized copy.
Well, what we are trying to do is implement a
singleton by making it an MBean. Is there a pattern
that most JBoss developers adhere to to do this?
Is binding my mbean to JNDI myself a commonly
used pattern or am I missing something?
Is there an example of the use of NonSerializedObjectFactory?
i have a clutch of mbeans i have implemented as singetons.
i think that was feasible because the underlying archtecture of JMX seems to point to an object that
is retained till it is not deregistered .
Am i correct in this assumption??
MBeans are indeed singletons in the sense that the MBeanServer manages particular object instances. On the other hand there is nothing preventing you from instantiating many mbeans that are instances of the same class, as long as they are identified by different object names.
Personally I tend to prefer to access mbeans by calling them through the mbean server. If I have a particularly heavily used method I usually supply a read-only Instance attribute (in other words a getInstance method in the MBean interface) that returns the instance to get the actual object for use.
For use of JNDI, I should have written NonSerializableFactory. One example is in server/src/main/org/jboss/jms/asf/ServerSessionPoolLoader.java.