Spring <jee:remote-slsb> and JBoss AS7 - No EJB receiver available for handling
- by Lech Glowiak
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>?