JBoss Community

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

created by Prasad M in JBoss AS 7 Development - View the full discussion

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/127.0.0.1:8081-1) Trying to get -->java:jboss/datasources/ExampleDS 
 
16:53:58,461 ERROR [stderr] (http-localhost/127.0.0.1:8081-1) javax.naming.NameNotFoundException: datasources/ExampleDS -- service jboss.naming.context.java.jboss.datasources.ExampleDS 
 
16:53:58,461 ERROR [stderr] (http-localhost/127.0.0.1:8081-1)           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.

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community