views:

327

answers:

1

Hi there,

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  A: 

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.

ewernli
I'd like to initialialize adapter with parameters from database table. Those are got by means of JPA. So, what is the best way I could follow? I know I can pass params to the connection in the outbound part as well as I can access params in the MDB in the inbound part, but, unfortunately, I need those params directly in the ResourceAdapter implementation.
mijer
Do you really need to have them in the database? The JCA specification support so-called "Administered Object" for configuration of JCA adapter. The configuration can usually be changed in the app. server admin console and can be looked up in JDNI from the JCA adapter. See p.21 of the doc I mentioned.
ewernli
Otherwise, I would try to access the configuration in database using pure JDBC. DataSource are just another kind of JCA adapter. And an adapter can maybe depend on another adapter.
ewernli
It's requirement of the customer to have all the settings in the database. I will try to use JDBC. Thanks a lot.
mijer