How to access EJB in 7.1.1 from remote client...
tdanecito May 21, 2012 1:44 AMHi,
I am moving from Jboss 5.1GA to 7.1.1 final and encountered some challenges when trying to access an EJB from a client app running in Tomcat in another jvm.
I noticed that when deploying my jar in a EAR from 5.1GA to 7.1.1 final that it bound the EJB's to only something called java:global/earname/jarname/beanname!classname
When I tried to access the ejb from a war app from Tomcat I get a javax.naming.NameNotFoundException not matter what changes I tried in the client code in the war file.
So I am wondering:
1. Is the EJB accessable using java:global/... from another jvm?
2. Can I use ejb:earname/jarname//beanname!classname without makeing any changes to existing EJB somehow?
3. To make number 2 work do I need to have "exported" the beans somehow?
4. Does the remote (org.jboss.naming.remote.client.InitialContextFactory) really allow remote access to another EJB in a jvm using Jboss proprietary java:global/...: from another jvm?
The code I am using for service locator to create the context for java:global/... is:
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.remote.client.InitialContextFactory");
properties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
properties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS", "JBOSS-LOCAL-USER");
properties.put(Context.PROVIDER_URL, "remote://" + serviceHost + ":4447");
properties.put(Context.SECURITY_PRINCIPAL,"name");
properties.put(Context.SECURITY_CREDENTIALS,"password");
If I try to use ejb:earname/...
Properties properties = new Properties();
properties.put(Context.URL_PKG_PREFIXES,"org.jboss.ejb.client.naming");
properties.put("jboss.naming.client.ejb.context", true);
properties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
properties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS", "JBOSS-LOCAL-USER");
properties.put(Context.PROVIDER_URL, "remote://" + serviceHost + ":4447");
properties.put(Context.SECURITY_PRINCIPAL,"name");
properties.put(Context.SECURITY_CREDENTIALS,"password");
Is the above correct?
Thanks,
-Tony