我能够成功查找远程接口,但是当我调用该bean的方法时,它会出现以下错误:
Exception in thread "main" java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:jmschat, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@413157
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:727)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:116)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)
at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:253)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:198)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:181)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:144)
at com.sun.proxy.$Proxy0.sendMessage(Unknown Source)
at Client.main(Client.java:64)
我的客户端代码是:
public static void main(String[] args) {
Properties jndiProperties=new Properties();
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.remote.client.InitialContextFactory");
jndiProperties.put(Context.PROVIDER_URL, "remote://127.0.0.1:4447");
jndiProperties.put("jboss.naming.client.ejb.context", true);
jndiProperties.put(Context.SECURITY_PRINCIPAL, "admin");
jndiProperties.put(Context.SECURITY_CREDENTIALS, "********");
jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
//jndiProperties.put("jboss.naming.client.ejb.context", true);
InitialContext ctx = null;
try {
ctx = new InitialContext(jndiProperties);
} catch (NamingException e) {
e.printStackTrace();
}
MessageProducerLocal messageProducerRemote= null;
try {
// assert ctx != null;
String appName="";
String moduleName="jmschat";
String distinctName="";
String beanName=MessageProducer.class.getSimpleName();
String viewClassName=MessageProducerLocal.class.getName();
//messageProducerLocal = (MessageProducerRemote) ctx.lookup("ejb:module/jmschat/MessageProducer!demo.jms.MessageProducerRemote");
messageProducerRemote = (MessageProducerLocal) ctx.lookup("ejb:"+appName+"/"+moduleName+"/"+distinctName+"/"+beanName+"!"+viewClassName);
} catch (NamingException e) {
e.printStackTrace();
}
messageProducerRemote.sendMessage("hello...this is msg");
}
给我错误的一行是:
messageProducerRemote.sendMessage("hello...this is msg");
我正在使用EJB 3.1和jboss EAP 6.1。我对两者都不熟悉。
我搜索了这个问题。但到处都发现这与查找有关。
欢迎任何帮助和建议。谢谢和问候