java - Wildfly 8.1.0 进行 EJB 远程调用时出错

标签 java jakarta-ee jboss

我在 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/

相关文章:

java - 在 Java 中将对象的 ArrayList 打印为具有非固定大小的表

java - 支付网关集成时获取 SSLException

java - 配置 JBOss 缓存以在 JBoss 服务器 4.2.3.GA 上运行

jboss - 我如何添加一个 jboss 7.1 模块,其中包含从服务器的主 ear 文件中的类实现/扩展的类?

java - 反编译、修改和重新编译android apk

Java 应用程序在 Eclipse 中正常运行,但不是 .jar

java - Jmockit 和 @PostConstruct bean

java - 从命令行执行 Jar 文件,文件夹名称中包含空格

java - 消息驱动 Bean-何时使用

java - 如何使用 Maven 设置 jboss seam 构建(包括下载和配置服务器)?