我在 wildly 8.1.0
中创建了一个使用 EJB 远程 session bean 的应用程序,但是当我进行查找时,出现此错误:
EJBCLIENT000025: No EJB receiver available for handling [appName:rb, moduleName:remot, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@75f1b0bc
我已将 application.xml 文件和 module.xml 文件配置为使用 "rb"
应用程序名称和 "remot"
模块名称。当我启动服务器时,它启动没有错误,并部署EJB
,所以我认为问题出在客户端,这是客户端的代码:
@SuppressWarnings({ "rawtypes", "unchecked" })
private static void busquedaServidor(Server.DatosRegistro datos) throws NamingException
{
final Hashtable jndiProperties = new Hashtable();
jndiProperties.put(Context.URL_PKG_PREFIXES,"org.jboss.ejb.client.naming);
final Context context = new InitialContext(jndiProperties);
final String appName = "rb";
final String moduleName = "remot";
final String distinctName = "";
final String beanName = Ejb.class.getSimpleName();
final String viewClassName = EjbRemote.class.getName();
String url = "ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName;
//ejb:rb/remot//Ejb!Server.EjbRemote
System.out.println(url);
EjbRemote envio= (EjbRemote) context.lookup(url);
envio.datosRegistro(datos);**
}
也许错误在于不同的名称,即为空,感谢您的帮助。
最佳答案
我在 Wildfly 10.1 上遇到了同样的问题。 我解决了用“/”替换“ejb:”的问题。对于您的情况:
String url = "/" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName;
远程上下文得到:
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
properties.put(Context.PROVIDER_URL, "http-remoting://" + host + ":" + port);
properties.put("jboss.naming.client.ejb.context", "true");
properties.put(Context.SECURITY_PRINCIPAL, "adminapp");
properties.put(Context.SECURITY_CREDENTIALS, "adminpwd");
来源:https://blog.akquinet.de/2014/09/26/jboss-eap-wildfly-three-ways-to-invoke-remote-ejbs/
希望有帮助。
关于java - Wildfly 8.1.0 进行 EJB 远程调用时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30087245/