I doubt it will work that way as the ClientFactory is not really remotable.
I'm not quite sure that the current JNDI implementation can be used
remotely...
You should try to use a remote client (by enabling the jms flow)
or send a request through a BC.
On 11/13/06, Ajeet Narayan <[EMAIL PROTECTED]> wrote:
hello,
I'm trying to externally connect to a running SM by obtaining a client
via JNDI. This is my code:
Properties env = new Properties( );
env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.xbean.spring.jndi.SpringInitialContextFactory");
env.put(Context.PROVIDER_URL, "jndi.xml");
System.out.println("Looking up: " +
ClientFactory.DEFAULT_JNDI_NAME);
Context context = new InitialContext(env);
Object contextObj = context.lookup(ClientFactory.DEFAULT_JNDI_NAME);
ClientFactory factory = (ClientFactory)contextObj;
ServiceMixClient client = factory.createClient();
client.close();
However, I do get the following exception:
Looking up: java:comp/env/jbi/ClientFactory
....
....
DEBUG - XBeanXmlBeanFactory - Invoking BeanPostProcessors
before initialization of bean 'jndi'
DEBUG - XBeanXmlBeanFactory - Invoking BeanPostProcessors
after initialization of bean 'jndi'
Exception in thread "main" javax.naming.NamingException: scheme java
not recognized
at
org.apache.xbean.spring.jndi.DefaultContext.lookup(DefaultContext.java:131)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at JBIClient.main(JBIClient.java:56)
Can you please provide me some hint?
cheers
--
Cheers,
Guillaume Nodet