users@glassfish.java.net

How to make the _at_Resources annotation work?

From: <glassfish_at_javadesktop.org>
Date: Wed, 28 Mar 2007 07:41:42 PST

Hello,

I have spent better part of two hours trying to make this thing work.

I am trying to do injection of multiple resources within my Servlet class. The code is something like this:

// all the relevant import statements

@Resources ({
     @Resource(name="myDB" type=javax.sql.DataSource),
     @Resource(name="myJMSConn" type=javax.jms.ConnectionFactory)
})
public class MyServlet extends javax.servlet.HTTPServlet
{
     // Relevant Servlet code
}

Now what exactly am I doing wrong here? Can someone please help me with the syntax? There are almost no examples of using @Resources (or a very similar @EJBs) annotation.

Thanks,
Rima.
[Message sent by forum member 'rpatel' (rpatel)]

http://forums.java.net/jive/thread.jspa?messageID=210297