问题
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).
- The JCA adapter defines an interface that will be used for communication.
- 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