Hello Ken,
Yes, of course, I missed the point that @Resources (as well as @EJBs) annotation is for declaring the dependency on a resource and not for injecting the resource itself. Thank you for making this crucial point.
Now, I finally figured out why my code (given in original post) would not compile. My syntax is wrong. Given here is the correct syntax:
@Resources ({
@Resource(name="myDB", type=javax.sql.DataSource.class),
@Resource(name="myJMSConn", type=javax.jms.ConnectionFactory.class)
})
public class MyServlet extends javax.servlet.HTTPServlet
{
// Relevant Servlet code
}
Note that I got the original syntax from the code snippet given in the Common Annotations spec (the spec has it wrong).
Thank you Ken!
Regards,
Rima.
[Message sent by forum member 'rpatel' (rpatel)]
http://forums.java.net/jive/thread.jspa?messageID=210496