Java EE – ejbclient0000025: no EJB sink to process?

I tried to connect from an executable Java application (not on JBoss locally) to a remote EJB on JBoss 7.2 locally

However, I received the following error / exception:

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)

Test the remote bean testservice and its implementation in ear

Server class:

@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;
    }
}

Customer code:

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

Client dependencies:

+- 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

Any ideas? Thank you in advance!

Solution

As long as you want to access "find" methods on remote EJBs, you need to keep the referenced initialcontext (it can't be garbage collected)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>