jaikiran pai [http://community.jboss.org/people/jaikiran] created the discussion

"Re: JNDI Lookup fails in JBoss AS 7 [java.naming.CommunicationException]"

To view the discussion, visit: http://community.jboss.org/message/640748#640748

--------------------------------------------------------------
Instead of doing a lookup:

DataSource ds = (javax.sql.DataSource) 
ctx.lookup("java:jboss/datasources/Test");


use injection:

@Resource (mappedName="java:jboss/datasources/Test")
private DataSource ds;


That'll setup the appropriate dependencies between the servlet and the 
datasource.
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/640748#640748]

Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to