java-ee – EJBCLIENT000025:没有EJB接收器可供处理?

前端之家收集整理的这篇文章主要介绍了java-ee – EJBCLIENT000025:没有EJB接收器可供处理?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图从可执行的 Java应用程序(本地不在JBoss上)连接到本地JBoss 7.2上的远程EJB.

但是我收到以下错误/异常:

java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:xx-xx,moduleName:xx-xx-business-impl,distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@14bc02d
    at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:693)
    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.doInvoke(EJBInvocationHandler.java:177)
    at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:161)
    at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:124)
    at com.sun.proxy.$Proxy0.getX(Unknown Source)
    at com...ris.client.PACSServiceTest.main(PACSServiceTest.java:71)

测试远程bean TestService及其实现在EAR中.

服务器类:

@Remote
public interface TestService {

    public int getX();

}

@Stateless
@Remote(TestService.class)
public class TestServiceBean implements TestService{

    @Override
    public int getX() {
        // TODO Auto-generated method stub
        return 1111;
    }
}

客户代码

final Hashtable jndiProperties = new Hashtable();
jndiProperties.put(Context.URL_PKG_PREFIXES,"org.jboss.ejb.client.naming");
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.remote.client.InitialContextFactory");
jndiProperties.put(Context.PROVIDER_URL,"remote://localhost:4447");

String jndiName = "ejb:orbis-dicom/orbis-dicom-business-impl//TestServiceBean!"
                  + TestService.class.getName();
logger.info(jndiName);

final Context context = new InitialContext(jndiProperties);
TestService service = (TestService) context.lookup(jndiName);

logger.info(service.getX());

jboss-ejb-client.properties:

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=xx
remote.connection.default.password=x

客户端依赖:

+- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.
nal:runtime
 +- org.jboss.spec.javax.ejb:jboss-ejb-api_3.1_spec:jar:1.0.2.Final:runtim

 +- org.jboss:jboss-ejb-client:jar:1.0.16.Final:runtime
 |  +- org.jboss.marshalling:jboss-marshalling:jar:1.3.16.GA:runtime (vers
naged from 1.3.15.GA)
 |  \- org.jboss.logging:jboss-logging:jar:3.1.2.GA:runtime
 +- org.jboss.xnio:xnio-api:jar:3.0.7.GA:runtime
 +- org.jboss.xnio:xnio-nio:jar:3.0.7.GA:runtime
 +- org.jboss.remoting3:jboss-remoting:jar:3.2.14.GA:runtime
 +- org.jboss.sasl:jboss-sasl:jar:1.0.3.Final:runtime
 +- org.jboss.marshalling:jboss-marshalling-river:jar:1.3.16.GA:runtime
 +- org.jboss.as:jboss-as-naming:jar:7.2.0.Final:provided
 |  +- org.jboss:jboss-remote-naming:jar:1.0.5.Final:provided
 |  +- org.jboss.msc:jboss-msc:jar:1.0.4.GA:provided
 |  +- org.jboss.as:jboss-as-server:jar:7.2.0.Final:provided
 |  |  +- org.jboss.as:jboss-as-controller:jar:7.2.0.Final:provided
 |  |  |  +- org.jboss.as:jboss-as-controller-client:jar:7.2.0.Final:provi

 |  |  |  \- org.jboss:staxmapper:jar:1.1.0.Final:provided
 |  |  +- org.jboss.as:jboss-as-domain-http-interface:jar:7.2.0.Final:prov

 |  |  |  +- org.jboss.as:jboss-as-domain-management:jar:7.2.0.Final:provi

 |  |  |  |  \- org.jboss:jboss-common-core:jar:2.2.17.GA:provided
 |  |  |  \- org.jboss.com.sun.httpserver:httpserver:jar:1.0.1.Final:provi

 |  |  +- org.jboss.as:jboss-as-deployment-repository:jar:7.2.0.Final:prov

 |  |  |  \- org.jboss.as:jboss-as-protocol:jar:7.2.0.Final:provided
 |  |  +- org.jboss.as:jboss-as-platform-mbean:jar:7.2.0.Final:provided
 |  |  +- org.jboss.as:jboss-as-process-controller:jar:7.2.0.Final:provide

 |  |  |  \- system:jdk-tools:jar:jdk:system
 |  |  +- org.jboss.as:jboss-as-remoting:jar:7.2.0.Final:provided
 |  |  |  \- org.jboss.as:jboss-as-network:jar:7.2.0.Final:provided
 |  |  +- org.jboss.as:jboss-as-version:jar:7.2.0.Final:provided
 |  |  +- org.jboss:jandex:jar:1.0.3.Final:provided
 |  |  +- org.jboss:jboss-dmr:jar:1.1.6.Final:provided
 |  |  +- org.jboss.invocation:jboss-invocation:jar:1.1.1.Final:provided
 |  |  +- org.jboss.logmanager:jboss-logmanager:jar:1.4.0.Final:provided
 |  |  +- org.jboss.logmanager:log4j-jboss-logmanager:jar:1.0.1.Final:prov

 |  |  +- org.jboss.modules:jboss-modules:jar:1.2.0.CR1:provided
 |  |  +- org.jboss.stdio:jboss-stdio:jar:1.0.1.GA:provided
 |  |  +- org.jboss.threads:jboss-threads:jar:2.1.0.Final:provided
 |  |  \- org.jboss:jboss-vfs:jar:3.1.0.Final:provided
 |  \- org.jboss.as:jboss-as-build-config:jar:7.2.0.Final:provided
 \- log4j:log4j:jar:1.2.16:compile

有任何想法吗?提前致谢!

解决方法

只要您想访问“查找”远程EJB上的方法,就需要保持引用的InitialContext(它不能被垃圾回收).
原文链接:https://www.f2er.com/java/121015.html

猜你在找的Java相关文章