我尝试使用此tutorial连接远程EJB,但所有得到的都是No EJB receiver available for handling
。这就是我的联系方式:
public static boolean CreateContext() throws ServletException {
System.out.println("Well-well");
boolean successCreate = false;
final Hashtable props = new Hashtable();
// setup the ejb: namespace URL factory
props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
props.put("jboss.naming.client.ejb.context", true);
// create the InitialContext
Context context = null;
try {
context = new javax.naming.InitialContext(props);
} catch (NamingException e) {
e.printStackTrace();
}
IssapageHome ref = null;
try {
ref =
(IssapageHome)context.lookup("ejb:" + "/ejb667//TheIssapage!" +
IssapageHome.class.getName());
} catch (NamingException e) {
e.printStackTrace();
}
try {
context.close();
} catch (Exception e) {
e.printStackTrace();
}
try {
//initContext = new javax.naming.InitialContext(env);
} catch (Exception e) {
log("Exception creating InitialContext: " + e.toString());
}
try {
// String JNDIName = "ejb/issapage";
// Object objref = initContext.lookup(JNDIName);
// initContext.close();
myIsapageHome =
(IssapageHome)PortableRemoteObject.narrow(ref, IssapageHome.class);
} catch (Exception e) {
log(" Issapage bean home not found: " + e.toString());
}
try {
myIsapageRemote = myIsapageHome.create();
successCreate = true;
} catch (Exception e) {
e.printStackTrace();
log(" Could not create the Issapage bean: " + e.toString());
}
return successCreate;
}
在此声明之后我抓住了异常:
myIsapageRemote = myIsapageHome.create();
Full st:
11:44:44,054 ERROR [stderr] (http-/127.0.0.1:8080-1) java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver a
vailable for handling [appName:, moduleName:ejb667, distinctName:] combination for invocation context org.jboss.ejb.clie
nt.EJBClientInvocationContext@103ad01b
11:44:44,058 ERROR [stderr] (http-/127.0.0.1:8080-1) at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBC
lientContext.java:735)
11:44:44,062 ERROR [stderr] (http-/127.0.0.1:8080-1) at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(Rec
eiverInterceptor.java:116)
11:44:44,067 ERROR [stderr] (http-/127.0.0.1:8080-1) at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(E
JBClientInvocationContext.java:183)
11:44:44,071 ERROR [stderr] (http-/127.0.0.1:8080-1) at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPoss
ibleRetries(EJBInvocationHandler.java:253)
11:44:44,075 ERROR [stderr] (http-/127.0.0.1:8080-1) at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocat
ionHandler.java:198)
11:44:44,080 ERROR [stderr] (http-/127.0.0.1:8080-1) at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocat
ionHandler.java:181)
11:44:44,084 ERROR [stderr] (http-/127.0.0.1:8080-1) at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocatio
nHandler.java:144)
11:44:44,088 ERROR [stderr] (http-/127.0.0.1:8080-1) at com.sun.proxy.$Proxy10.create(Unknown Source)