JNDI Lookup from host to host
s.horn Jul 18, 2013 10:49 AMHello,
i have a question about ejb invocation from an other host.
with jboss6 it was possible to define the lookup url of the destination server via Properties in the InitialContext (provider url).
We use the following code in our ejb for looking up to the remote interface on destination server:
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
env.put(Context.PROVIDER_URL, "remote://<destination>:4447");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
env.put("jboss.naming.client.ejb.context", true);
env.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", false);
env.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS", "JBOSS-LOCAL-USER");
env.put(Context.SECURITY_PRINCIPAL, "username");
env.put(Context.SECURITY_CREDENTIALS, "password");
Context ctx = new InitialContext(env);
RemoteInterface remote = (RemoteInterface)ctx.lookup("ear/jar/...");
The following exception occures:
15:03:59,131 ERROR [stderr] (http--0.0.0.0-8080-2) javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jboss.naming.remote.client.InitialContextFactory from classloader ModuleClassLoader for Module "application-DEV.war:main" from Service Module Loader
15:03:59,147 ERROR [stderr] (http--0.0.0.0-8080-2) at org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:64)
15:03:59,162 ERROR [stderr] (http--0.0.0.0-8080-2) at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:681)
15:03:59,162 ERROR [stderr] (http--0.0.0.0-8080-2) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
15:03:59,162 ERROR [stderr] (http--0.0.0.0-8080-2) at javax.naming.InitialContext.init(InitialContext.java:242)
15:03:59,178 ERROR [stderr] (http--0.0.0.0-8080-2) at javax.naming.InitialContext.<init>(InitialContext.java:216)
15:03:59,178 ERROR [stderr] (http--0.0.0.0-8080-2) at de.procar.timemanagement.bdeimpl.ecaros2.Ecaros2BDE.login(Ecaros2BDE.java:216)
15:03:59,194 ERROR [stderr] (http--0.0.0.0-8080-2) at de.procar.timemanagement.bdeimpl.ecaros2.Ecaros2BDE.login(Ecaros2BDE.java:122)
15:03:59,194 ERROR [stderr] (http--0.0.0.0-8080-2) at de.procar.timemanagement.client.struts2.container.LoginAction.execute(LoginAction.java:74)
15:03:59,209 ERROR [stderr] (http--0.0.0.0-8080-2) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
15:03:59,225 ERROR [stderr] (http--0.0.0.0-8080-2) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
15:03:59,225 ERROR [stderr] (http--0.0.0.0-8080-2) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
15:03:59,225 ERROR [stderr] (http--0.0.0.0-8080-2) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
15:03:59,241 ERROR [stderr] (http--0.0.0.0-8080-2) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
15:03:59,241 ERROR [stderr] (http--0.0.0.0-8080-2) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
15:03:59,241 ERROR [stderr] (http--0.0.0.0-8080-2) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
15:03:59,256 ERROR [stderr] (http--0.0.0.0-8080-2) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
15:03:59,256 ERROR [stderr] (http--0.0.0.0-8080-2) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
15:03:59,256 ERROR [stderr] (http--0.0.0.0-8080-2) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
15:03:59,272 ERROR [stderr] (http--0.0.0.0-8080-2) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
15:03:59,272 ERROR [stderr] (http--0.0.0.0-8080-2) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
15:03:59,287 ERROR [stderr] (http--0.0.0.0-8080-2) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
15:03:59,287 ERROR [stderr] (http--0.0.0.0-8080-2) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
15:03:59,287 ERROR [stderr] (http--0.0.0.0-8080-2) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
15:03:59,287 ERROR [stderr] (http--0.0.0.0-8080-2) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
15:03:59,303 ERROR [stderr] (http--0.0.0.0-8080-2) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
15:03:59,319 ERROR [stderr] (http--0.0.0.0-8080-2) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
15:03:59,319 ERROR [stderr] (http--0.0.0.0-8080-2) at java.lang.Thread.run(Thread.java:724)
What is wrong with this code?
Thanks in advance.
Sascha