-
1. Re: Integreate custom services via MBeans
adrian.brock Oct 3, 2002 9:00 PM (in response to roysun)Which jndiname?
Have you tried listing the initial context?
Regards,
Adrian -
2. Re: Integreate custom services via MBeans
roysun Oct 4, 2002 11:01 AM (in response to roysun)The jndiName is "ValidatorFactory" defined like ValidatorFactory in user-service.xml.
I use the following code to list and got NamingEnumeration which include the information like "ValidatorFactory: java.util.HashMap". But I still get null from lookup("ValidatorFactory").
Any others I need to consider?
Thanks
Roy
====
NamingEnumeration e = initial.list("");
while(e.hasMore())
{
System.out.println("e=" + e.next());
} -
3. Re: Integreate custom services via MBeans
adrian.brock Oct 4, 2002 1:43 PM (in response to roysun)Does it work when you lookup inside JBoss?
What does the binding code look like?
Regards,
Adrian -
4. Re: Integreate custom services via MBeans
roysun Oct 4, 2002 2:30 PM (in response to roysun)It is same as the sample code in document.
Roy
===
private void rebind() throws NamingException
{
InitialContext rootCtx = new InitialContext();
// Get the parent context into which we are to bind
Name fullName = rootCtx.getNameParser("").parse(jndiName);
log.debug("fullName="+fullName);
Name parentName = fullName;
if( fullName.size() > 1 )
parentName = fullName.getPrefix(fullName.size()-1);
else
parentName = new CompositeName();
Context parentCtx = createContext(rootCtx, parentName);
Name atomName = fullName.getSuffix(fullName.size()-1);
String atom = atomName.get(0);
NonSerializableFactory.rebind(parentCtx, atom, new java.util.HashMap());
} -
5. Re: Integreate custom services via MBeans
adrian.brock Oct 4, 2002 2:49 PM (in response to roysun)There's your answer,
NonSerializableFactory is for binding
stuff locally. If you send it over the wire,
the bindings are lost, they are held in a static map.
Regards,
Adrian -
6. Re: Integreate custom services via MBeans
roysun Oct 4, 2002 3:01 PM (in response to roysun)If there is any way to solve the problem? I want the registered object be accessed globally.
Thanks
Roy -
7. Re: Integreate custom services via MBeans
adrian.brock Oct 4, 2002 3:51 PM (in response to roysun)I assume you are talking about an MBean from the
title of this thread.
Binding an object into JNDI won't work for anything
but trivial objects, because the client will get a
serialized copy.
You need to bind a proxy or remote object that
invokes back on the server object.
Alteratively, for an MBean use an adaptor/connector
such as the RMI adaptor. There are plenty of threads
on this.
Next week, somebody is commiting a remoting system
to JBossMX. I've not had chance to look at the details
yet, but the basic function is to allow discovery
of remote mbeans and bind them into your local
MBeanServer. The remote nature of the MBean is
transparent, I think?
Regards,
Adrian -
8. Re: Integreate custom services via MBeans
roysun Oct 4, 2002 5:00 PM (in response to roysun)Very interesting.
In my case, I'll use session bean to wrap the registered object through JNDI lookup. The remote client can access the registered object via the session bean. It should work. Right?
Thank you very much.
Roy -
9. Re: Integreate custom services via MBeans
adrian.brock Oct 5, 2002 8:38 AM (in response to roysun)That is one way of doing it :-)
Regards,
Adrian