Remote lookup using @ejb annotation

前端 未结 3 1981
-上瘾入骨i
-上瘾入骨i 2021-02-09 18:11

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 ClientE

3条回答
  •  梦如初夏
    2021-02-09 18:22

    @EJB annotation can only be used if the applications are deployed in the same sever instance. @EJB annotation won't work if you are trying to make cross server instance call or remote server call. So, in your case, annotation injection won't work.

    So, what are the solutions ?

    Option 1) Use old style programmatic JNDI look up

    Option 2) Create managed bean as per CDI (Context Dependency Injection) and configure all the JNDI properties there. And @inject the managed bean into your client.

提交回复
热议问题