Get reference to the EJB3 local business interface inside the JCA adapter

有些话、适合烂在心里 提交于 2019-12-11 08:52:36

问题


I'd like to know whether it is possible to get a reference to the ejb3 local business interfaces inside the jca adapter?

Resource adapter and ejb .jar are packed into the same .ear. Application is running under WebSphere AS 6.1 with ejb3 featurepack.

I have tried to use ejblocal:<full_class_name_of_local_interface> as JNDI name, but without success.


回答1:


What you are trying to do is probably conceptually wrong. JCA adapter should not depend on EJB -- a JCA adapter should not lookup an EJB.

But JCA adapters work for inbound and outbound connectivity though. The right way to have a JCA connector communicate with an EJB (inbound connectivity), it through message driven bean (MDB).

  1. The JCA adapter defines an interface that will be used for communication.
  2. Then a custom MDB can implement this interface and can receive inbound requests from the adapter.

I agree that in this case the name "message-driven bean" is a bit misleading. The custom MDB is really like an EJB and receive calls from the JCA connector. It's not necessary related to message nor asynchronous processing. If you want the custom MDB can then lookup or have other EJB inject to delegate the processing.

The best doc to look at is "Creating Resource Adapter with J2EE Connector Architecture 1.5". It gives an example for inbound and outbound connectivity. The corresponding code can be found in the J2EE samples which come with the SDK.



来源:https://stackoverflow.com/questions/2449253/get-reference-to-the-ejb3-local-business-interface-inside-the-jca-adapter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!