【问题标题】:Spring <jee:remote-slsb> and JBoss AS7 - No EJB receiver available for handlingSpring <jee:remote-slsb> 和 JBoss AS7 - 没有 EJB 接收器可用于处理
【发布时间】:2012-10-05 21:34:50
【问题描述】:

我在 JBoss AS 7 上有 @Remote EJB,可以通过名称 java:global/RandomEjb/DefaultRemoteRandom!pl.lechglowiak.ejbTest.RemoteRandom 获得。

独立客户端是使用&lt;jee:remote-slsb&gt; bean 的Spring 应用程序。 尝试使用该 bean 时,我得到 java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:RandomEjb, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@1a89031

这是 applicationContext.xml 的相关部分:

<jee:remote-slsb id="remoteRandom"
    jndi-name="RandomEjb/DefaultRemoteRandom!pl.lechglowiak.ejbTest.RemoteRandom"
    business-interface="pl.lechglowiak.ejbTest.RemoteRandom"
    <jee:environment>
        java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory
        java.naming.provider.url=remote://localhost:4447
        jboss.naming.client.ejb.context=true
        java.naming.security.principal=testuser
        java.naming.security.credentials=testpassword
    </jee:environment>
</jee:remote-slsb>

<bean id="remoteClient" class="pl.lechglowiak.RemoteClient">
    <property name="remote" ref="remoteRandom" />
</bean>

RemoteClient.java 公共类 RemoteClient {

private RemoteRandom random;

public void setRemote(RemoteRandom random){
    this.random = random;
}

public Integer callRandom(){
    try {
        return random.getRandom(100);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

}

我的 jboss 客户端 jar: org.jboss.as jboss-as-ejb-client-bom 7.1.2.决赛 绒球

pl.lechglowiak.ejbTest.RemoteRandom 可用于客户端应用程序类路径。 jndi.properties 包含与&lt;jee:environment&gt; of &lt;jee:remote-slsb&gt; 中的确切属性。

这样的代码运行无异常:

Context ctx2 = new InitialContext();
RemoteRandom rr = (RemoteRandom)  ctx2.lookup("RandomEjb/DefaultRemoteRandom!pl.lechglowiak.ejbTest.RemoteRandom");
System.out.println(rr.getRandom(10000));

但是这个:

ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
RemoteClient client = ctx.getBean("remoteClient", RemoteClient.class);
System.out.println(client.callRandom());

以异常结束:java.lang.IllegalStateException: EJBCLIENT000025: 没有 EJB 接收器可用于处理调用上下文 org.jboss.ejb.client.EJBClientInvocationContext@1a89031 的 [appName:, moduleName:RandomEjb, distinctName:] 组合。

jboss.naming.client.ejb.context=true 已设置。 你知道我在&lt;jee:remote-slsb&gt; 中设置的错误吗?

【问题讨论】:

标签: spring ejb jboss7.x


【解决方案1】:

我刚刚解决了一个非常相似的问题。您是否创建了“jboss-ejb-client.propeties”文件?

如果没有,请查看以下内容: https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI(特别是“设置 EJB 客户端上下文属性”子主题)

https://community.jboss.org/message/740827

https://community.jboss.org/thread/197989

您应该将文件放在客户端的类路径中。这是一个简单的示例:

remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

remote.connections=default

remote.connection.default.host=localhost
remote.connection.default.port=4447
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

remote.connection.default.username=login
remote.connection.default.password=password

祝你好运!

PS:此配置中唯一特定于项目的值是“用户名”和“密码”。

PS2:如果您还没有将用户添加到您的 jboss 设置中,它是通过位于您的 jboss 文件夹中的“bin/add-user.[bat/sh]”脚本完成的。

【讨论】:

    【解决方案2】:

    expose-access-context="true" 设置为 jee:remote-slsb taglib。

    【讨论】:

      【解决方案3】:

      使用 java.naming.factory.url.pkgs=org.jboss.ejb.client.naming 代替 java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory

      【讨论】:

        猜你喜欢
        • 2013-02-28
        • 1970-01-01
        • 2017-04-19
        • 2012-09-08
        • 2016-07-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多