使用@ejb注释远程查找 [英] Remote lookup using @ejb annotation
问题描述
服务器耳朵暴露一些ejb的。我想通过注释将它注入ClientEar。使用JNDI查找我做的很好,它的工作原理。但是使用注释我总是得到javax.naming.NamingException。
然而,当注入会话bean遍历部署工件时,全局JNDI名称必须用于注入,我也使用了
@EJB(mappedName =java:global / Server / component / ApplicationService! test.server.ApplicationServiceInterface)
但是,似乎我没有提供远程服务器的provider_url将其绑定到客户端耳朵实例。
我如何配置jndi属性,即provider_url,带有注释@ EJB的初始上下文属性?
我发现一个解决您的问题的论坛帖子:
https://community.jboss.org/thread/228789
其中他指的是 https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+server+instance
要使用@EJB annotaion完成jndi查找,他使用
@EJB(lookup =ejb:earname / modulename / BeanClass!fully.qualified.RemoteInterface)
private RemoteInterface bean;
I have 2 servers instances of Jboss 5, each of which is deployed with two EAR's. Say Client.Ear and Server.Ear. Server Ear expose some ejb's. I want to inject this to ClientEar via annotation. Using JNDI lookup i did it fine and it works. But using annotation i always get javax.naming.NamingException. However when injecting session beans accross deployment artifacts the global JNDI name has to be used for injection and i used that also like @EJB(mappedName ="java:global/Server/component/ApplicationService!com.test.server.ApplicationServiceInterface")
But it seems like I am not providing the provider_url of the remote server to bound it to the client ear instance. How could i configure jndi properties, ie provider_url, initial context properites with the annotation @ EJB?
I found a forum post that answers your question: https://community.jboss.org/thread/228789
In it he refers to https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+server+instance
And to accomplish the jndi lookup with the @EJB annotaion he uses
@EJB(lookup = "ejb:earname/modulename/BeanClass!fully.qualified.RemoteInterface")
private RemoteInterface bean;
这篇关于使用@ejb注释远程查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!