-
15. Re: Remote EJB invocation failure for ear deployment
alxt Mar 19, 2012 9:46 AM (in response to berni02)Hi!
I try test jboss 7.1.1
Bernhard Günter's solution not help...
In server (reduced example from https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI ):
@Remote
public interface TestRemote {
int add(int a, int b);
}
@Stateless
public class TestBL implements TestRemote {
@Override
public int add(int a, int b) {
return a+b;
}
}
create simple jar, deploy in jboss 7.1.1 (standalone), message:
17:08:28,628 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "JBoss7Test-0.SHAPSHOT.jar"
17:08:28,659 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named TestBL in deployment unit deployment "JBoss7Test-0.SHAPSHOT.jar" are as follows:
java:global/JBoss7Test-0.SHAPSHOT/TestBL!ru.start2com.test.jboss7.beans.TestRemote
java:app/JBoss7Test-0.SHAPSHOT/TestBL!ru.start2com.test.jboss7.beans.TestRemote
java:module/TestBL!ru.start2com.test.jboss7.beans.TestRemote
java:jboss/exported/JBoss7Test-0.SHAPSHOT/TestBL!ru.start2com.test.jboss7.beans.TestRemote
java:global/JBoss7Test-0.SHAPSHOT/TestBL
java:app/JBoss7Test-0.SHAPSHOT/TestBL
java:module/TestBL
17:08:28,706 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "JBoss7Test-0.SHAPSHOT.jar"
make client with properties file:
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=localhost
remote.connection.default.port = 4447
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
endpoint.name=client-endpoint
and code:
private static void invokeStatelessBean() throws NamingException {
TestRemote statelessRemoteCalculator = lookupRemoteStatelessCalculator();
int sum = statelessRemoteCalculator.add(3, 4);
System.out.println("sum = " + sum);
}
private static TestRemote lookupRemoteStatelessCalculator() throws NamingException {
Security.addProvider(new JBossSaslProvider());
final Hashtable<String, String> p = new Hashtable<String, String>();
p.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
p.put(Context.SECURITY_PRINCIPAL, "alxt");
p.put(Context.SECURITY_CREDENTIALS, "123");
final Context context = new InitialContext(p);
return (TestRemote) context.lookup("ejb:app/JBoss7Test-0.SHAPSHOT/TestBL!ru.start2com.test.jboss7.beans.TestRemote");
}
Exception in client:
Exception in thread "main" java.lang.IllegalStateException: No EJB receiver available for handling [appName:app,modulename:JBoss7Test-0.SHAPSHOT,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@7ff5b6
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
at $Proxy0.add(Unknown Source)
at ru.start2com.test.jboss7.client.TestRemoteClient.invokeStatelessBean(TestRemoteClient.java:23)
Exception in server:
17:09:29,677 ERROR [org.jboss.remoting.remote.connection] (Remoting "alxt" read-1) JBREM000200: Remote connection failed: java.io.IOException
in application-users.properties user alxt exists, password is 123
I check, what jboss-ejb-client.properties used (if change port in this file, error just changed).
-
16. Re: Remote EJB invocation failure for ear deployment
alxt Mar 23, 2012 9:16 AM (in response to alxt)Need change
return (TestRemote) context.lookup("ejb:app/JBoss7Test-0.SHAPSHOT/TestBL!ru.start2com.test.jboss7.beans.TestRemote");
to
return (TestRemote) context.lookup("ejb:/JBoss7Test-0.SHAPSHOT//TestBL!ru.start2com.test.jboss7.beans.TestRemote");
PS: How add my login module? In 6.x need add <application-policy name = "RolesLoginModule"><authentication><login-module code = "my.class.name" flag = "required"/></authentication></application-policy> to file /server/default/conf/login-config.xml ...