使用@ejb注释远程查找 [英] Remote lookup using @ejb annotation

查看:129
本文介绍了使用@ejb注释远程查找的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个Jboss 5的服务器实例,每个都有两个EAR。说Client.Ear和Server.Ear。
服务器耳朵暴露一些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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆