8 Replies Latest reply on Dec 3, 2012 1:47 AM by Nicklas Karlsson

    Unable to lookup datasource in jboss-as-7.2.0.Alpha1-SNAPSHOT

    Prasad M Newbie

      I have developed a simple web application to lookup the datasource 'java:jboss/datasources/ExampleDS'.

      Below is the logic in the init method of my servlet:


      strDSName = "java:jboss/datasources/ExampleDS";
      Context ctx = new InitialContext(); 
      ds = (javax.sql.DataSource) ctx.lookup(strDSName);



      I am starting jboss in domain mode and when I invoke the servlet I am getting the NamingException,

      below is the stacktrace:


      16:53:58,445 INFO  [stdout] (http-localhost/ Trying to get -->java:jboss/datasources/ExampleDS 
      16:53:58,461 ERROR [stderr] (http-localhost/ javax.naming.NameNotFoundException: datasources/ExampleDS -- service jboss.naming.context.java.jboss.datasources.ExampleDS 
      16:53:58,461 ERROR [stderr] (http-localhost/           at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:103)



      Just fyi the same code works well in jboss-as-7.1.1.Final.

      Please suggest if anything else has to be done to make it work on jboss-as-7.2.0.Alpha1-SNAPSHOT


      PFA the sample web application.