问题
I've a strange problem. I've install JbossAS 7.1.1 and deployed my ear file successfully.
My client is running to tomcat 6.035.
I can make successful EJB calls to my jboss deployment - but one specific EJB calls fails.
my client environment setup is as below :-
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.remote.client.InitialContextFactory");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
env.put(Context.PROVIDER_URL, "remote://localhost:4447");
env.put(Context.SECURITY_PRINCIPAL, "abc");
env.put(Context.SECURITY_CREDENTIALS, "123");
env.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
env.put("jboss.naming.client.ejb.context", "true");
env.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
env.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");
//env.put("remote.connection.x1.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");
logger.debug("Added security ");
try {
ctx = new InitialContext(env);
} catch (NamingException e) {
logger.error("Can't get initial context.");
e.printStackTrace();
}
The stracktrace is very strange. Its looking for RemoteNamingEJBClient Please help - I'm out of idea.
18:03:25,541 WARN [org.jboss.modules] (EJB default - 8) Failed to define class org.jboss.naming.remote.client.ejb.RemoteNamingEjbClientContextSelector in Module "org.jboss.remote-naming:main" from local module loader @50988 (roots: jbossAS7/modules): java.lang.LinkageError: Failed to link org/jboss/naming/remote/client/ejb/RemoteNamingEjbClientContextSelector (Module "org.jboss.remote-naming:main" from local module loader @50988 (roots: jbossAS7/modules))
Caused by: java.lang.NoClassDefFoundError: org/jboss/ejb/client/ContextSelector
Caused by: java.lang.ClassNotFoundException: org.jboss.ejb.client.ContextSelector from [Module "org.jboss.remote-naming:main" from local module loader
回答1:
I've solved this problem by adding
ejb-client module in remote-naming module
this issue is tracked here-
https://issues.jboss.org/browse/AS7-4872
<resources>
<resource-root path="jboss-remote-naming-1.0.2.Final.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="javax.api"/>
<module name="org.jboss.ejb-client" />
<module name="org.jboss.remoting3"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.marshalling"/>
<module name="org.jboss.marshalling.river"/>
</dependencies>
来源:https://stackoverflow.com/questions/18005838/remote-ejb-call-failed-after-successful-calls