在eclipse中编写EJB客户端调用远程JBoss服务器上的无状态会话bean时,总是报错。
报错信息如下:
Exception in thread "main" java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:FirstEJB, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@10bdf5e5
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:798)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:186)
at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:255)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:200)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:183)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:146)
at com.sun.proxy.$Proxy0.saySomething(Unknown Source)
解决方法:
1、查看服务器是否有启动(下图没启动)
2、查看Jboss-ejb-client.properties存放的路径是否正确
2、Jboss-ejb-client.properties里面的内容是否正确
最后运行(成功):