我正在关注本教程: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
答案 0 :(得分:0)
您应该在项目/客户端应用程序中添加的唯一库是\ bin \ client \ jboss-client.jar