【发布时间】:2014-11-08 15:14:08
【问题描述】:
我正在关注本教程:https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI?_sscc=t
我只使用它的无状态 bean 部分。 我得到了这个异常
Obtained a remote stateless calculator for invocation
Adding 204 and 340 via the remote stateless calculator deployed on the server
Exception in thread "main" java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:MyFirstEJBProj,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@5f9f89ee
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 com.sun.proxy.$Proxy0.add(Unknown Source)
at trial_client.RemoteEJBClient.invokeStatelessBean(RemoteEJBClient.java:26)
at trial_client.RemoteEJBClient.main(RemoteEJBClient.java:16)
我收到这条线的例外:int sum = statelessRemoteCalculator.add(a, b);
我的代码是:
final RemoteCalculator statelessRemoteCalculator = lookupRemoteStatelessCalculator();
System.out.println("Obtained a remote stateless calculator for invocation");
// invoke on the remote calculator
int a = 204;
int b = 340;
System.out.println("Adding " + a + " and " + b + " via the remote stateless calculator deployed on the server");
int sum = statelessRemoteCalculator.add(a, b);
System.out.println("Remote calculator returned sum = " + sum);
if (sum != a + b) {
throw new RuntimeException("Remote stateless calculator returned an incorrect sum " + sum + " ,expected sum was " + (a + b));
}
我错过了任何 JAR 吗?
我将我的客户端作为“运行 java 应用程序”运行。
编辑:
我的jboss-ejb-client.properties 文件
endpoint.name=client-endpoint
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
remote.connection.default.username=appuser
remote.connection.default.password=apppassword
【问题讨论】: