users@glassfish.java.net

Re: Glassfish, MySQL and _at_Resource

From: Shalini Muthukrishnan <Shalini.Muthukrishnan_at_Sun.COM>
Date: Tue, 10 Jun 2008 11:30:24 +0530

Could you try to add mappedName="jdbc/__MysqlPool" inside the Resource
injection?

glassfish_at_javadesktop.org wrote:
> Hello Shalini,
>
> My Databaseconnection seems to be fine, I get it rolling using the following ( skipping DI ):
>
> [i]InitialContext initialContext;
> DataSource dataSource=null;
> try {
> initialContext = new InitialContext();
> dataSource = (DataSource) initialContext.lookup("jdbc/__MysqlPool");[/i]
>
>
> What I would like to do is to accomplish this by using Dependecy Injection:
> public class JDBCSelectServlet extends javax.servlet.http.HttpServlet {
> @Resource(name="jdbc/__MysqlPool")
> private javax.sql.DataSource dataSource;
>
> But the datasource is never set.
>
> I Seem to be having problem with DI.
> Is there something I should do, for getting DI going ?
>
> regards, i
> [Message sent by forum member 'inkimar' (inkimar)]
>
> http://forums.java.net/jive/thread.jspa?messageID=279235
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>