Spring< jee:remote-slsb>和JBoss AS7 - 无EJB接收器可用于处理 [英] Spring <jee:remote-slsb> and JBoss AS7 - No EJB receiver available for handling
问题描述
java:global / RandomEjb / DefaultRemoteRandom!pl.lechglowiak.ejbTest.RemoteRandom
。 独立客户端是使用< jee:remote-slsb>
bean的Spring应用程序。
当尝试使用该bean时,我得到 java.lang.IllegalStateException:EJBCLIENT000025:没有EJB接收方可用于处理调用上下文org.jboss的[appName :, moduleName:RandomEjb,distinctName:]组合.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 =remoteClientclass =pl.lechglowiak.RemoteClient>
< property name =remoteref =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();
返回null;
}
}
}
我的jboss客户端jar:
org.jboss.as
jboss-as-ejb-client-bom
7.1.2.Final
pom
pl.lechglowiak.ejbTest.RemoteRandom可用于客户端应用程序类路径。
jndi.properties包含确切的属性,如< jee:environment>
中< jee:remote-slsb>
。
这样的代码运行无一例外:
上下文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接收器可用于处理[appName: ,moduleName:RandomEjb,distinctName:]组合用于调用上下文org.jboss.ejb.client.EJBClientInvocationContext@1a89031。
jboss.naming.client.ejb.context = true
设置。
你有什么想法我在< jee:remote-slsb>
中设置错误?
我刚刚解决了一个非常类似的问题。您是否创建了一个jboss-ejb-client.propeties文件?
如果没有,请查看以下内容:
(特别是设置EJB客户端上下文属性子主题)
< a href =https://community.jboss.org/message/740827 =nofollow> https://community.jboss.org/message/740827
https://community.jboss.org/thread/197989
您应该将该文件放在客户端的类路径中。以下是一个简单的例子:
remote.connectionprovider.create.options.org.xnio.Options。 SSL_ENABLED = false
remote.connections =默认
remote.connection.default.host = localhost
remote.connection.default.port = 4447
遥控器连接b $ b
祝你好运!
此配置中的项目特定值将是用户名和密码。
PS2:为了防止您没有将用户添加到您的jboss集合通过位于您的jboss文件夹的bin / add-user。[bat / sh]脚本完成。
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.
这篇关于Spring< jee:remote-slsb>和JBoss AS7 - 无EJB接收器可用于处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!