JNDI lookup of JCA 1.6 on GlassFish

2k views Asked by At

I`m newbie at jca. I read specification of jca 1.6 and there are a lot of references to jndi like this:

A component looks up a ConnectionFactory instance from the JNDI namespace ...

Or

initctx.lookup(“java:comp/env/eis/MyEIS”);

But I couldn`t find how to specify jndi name for my jca. Or what fields of ra.xml are used to register my resource adapter ConnectionFactory.

Please write a small example or ref me to some concete page or section of specification, eventually any advice are welcome.

Thanks

Solved: specifying jndi name of jca is specific to Java EE environment implementation. In GlassFish there is menu Resources->Connectors->Connector Resources.

2

There are 2 answers

0
Kris On BEST ANSWER

Try the IBM tutorial on JCA: http://www.ibm.com/developerworks/java/tutorials/j-jca/ , it contains simple hello world application and you can download the sources too.

0
Jonathan S. Fisher On

The best way is to use the @Resource annotation or the @Inject annotation. Which one you choose is dependent on your resource:

@Remote(SomeService.class)
@Stateless
public class SomeBean implements SomeService {
 @Resource(mappedName="comp/env/eis/MyEIS")
 ResourceX resourceX;

 ...
}