2014-11-08 61 views
1

我正在學習本教程:https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI?_sscc=t運行EJB應用程序

我只使用無狀態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 [email protected] 
    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

,你應該在你的項目/客戶端應用程序添加的\ BIN \客戶\的jboss-client.jar中

唯一庫