How to use @resource with a connector
I have written a JCA 1.5 connector and have successfully deployed it.
How do i use the @Resource annotation to load the connectionfactory in a web application?
Below are some code snippets of config files and the sevlet.
I have tried @Resource, @Resource(name="EISconnectionFactory"), and @Resource(name="eis/myconnector") but always get null for cf.
eis/myconnector is the JNDI name of the connector resource
protocol.ra.MyConnectionFactory is the Connection Definition of the connection pool
<br /> -- test.java --<br /> ...<br /> @Resource<br /> private MyConnectionFactory cf;<br /> ...<br />
<br /> -- web.xml --<br /> ...</p> <p> EISconnectionFactory</p> <p> protocol.ra.MyConnectionFactory</p> <p> Container<br /> Shareable</p> <p>...<br />
<br /> -- sun-web.xml --<br /> ...</p> <p> EISconnectionFactory<br /> eis/myconnector</p> <p>...<br />
Any help will be appreciated.