[jboss-user] [Beginner's Corner] - Datasource specification in web.xml

Jan Vrtiska do-not-reply at jboss.com
Thu Nov 17 04:01:01 EST 2011

Jan Vrtiska [http://community.jboss.org/people/xjohnx] created the discussion

"Datasource specification in web.xml"

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

I have my project application which has been connecting to one simple datasource(which was defined in jbos-web.xml). Now I need to build form my application two *.war files and each of them will use different datasource. Since Im using ant, I can change in my build.xml file destination of web.xml file. So I have two web.xml files with different datasource deffinitions.
The problem is, that my solition is not working. After triing to reach my appplication i get error:

*javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: jdbc not bound]*



java code:
InitialContext ctx = null;
 try {
 ctx = new InitialContext();
 dataSource = (DataSource) ctx.lookup("java:comp/env/DataSource");
 LOG.info("lookup na datasource");
 } catch (NamingException e) {
 // TODO Auto-generated catch block
 this.daoFactory = new DaoFactory(this.dataSource);

I've tried to search solution on web but without any success.
Thanks for any help.

Reply to this message by going to Community

Start a new discussion in Beginner's Corner at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111117/20ac39c8/attachment.html 

More information about the jboss-user mailing list