3 Replies Latest reply on Nov 18, 2011 7:17 AM by Jan Vrtiska

    Datasource specification in web.xml

    Jan Vrtiska Newbie


      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.