I have got @Remote EJB on JBoss AS 7, available by name java:global/RandomEjb/DefaultRemoteRandom!pl.lechglowiak.ejbTest.RemoteRandom
.
Standalone client is Spring application that uses <jee:remote-slsb>
bean.
When trying to use that bean I get java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:RandomEjb, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@1a89031
.
Here is relevant part of 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 public class 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;
}
}
}
My jboss client jar: org.jboss.as jboss-as-ejb-client-bom 7.1.2.Final pom
pl.lechglowiak.ejbTest.RemoteRandom is available for client application classpath.
jndi.properties contains exact properties as in <jee:environment>
of <jee:remote-slsb>
.
Such code runs without exception:
Context ctx2 = new InitialContext();
RemoteRandom rr = (RemoteRandom) ctx2.lookup("RandomEjb/DefaultRemoteRandom!pl.lechglowiak.ejbTest.RemoteRandom");
System.out.println(rr.getRandom(10000));
But this:
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
RemoteClient client = ctx.getBean("remoteClient", RemoteClient.class);
System.out.println(client.callRandom());
ends with exception: java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:RandomEjb, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@1a89031.
jboss.naming.client.ejb.context=true
is set.
Do you have any idea what am I setting wrong in <jee:remote-slsb>
?
I just solved a very similar problem. Have you created a "jboss-ejb-client.propeties" file?
If not, check out these: https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI (particularly the "Setting up EJB client context properties" sub-topic)
https://community.jboss.org/message/740827
https://community.jboss.org/thread/197989
You should place the file in the classpath of your client. Here is an simple example of what it could look like:
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
Good luck!
PS: The only project-specific values in this configuration would be the "username" and "password".
PS2: And just in case you haven't added a user to your jboss set-up, it's done through the "bin/add-user.[bat/sh]" script, located at your jboss folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With