[jboss-dev-forums] [JBoss AS 7 Development] - Unable to lookup datasource in jboss-as-7.2.0.Alpha1-SNAPSHOT
Prasad M
do-not-reply at jboss.com
Thu Nov 29 06:28:02 EST 2012
Prasad M [https://community.jboss.org/people/mp_lbi] created the discussion
"Unable to lookup datasource in jboss-as-7.2.0.Alpha1-SNAPSHOT"
To view the discussion, visit: https://community.jboss.org/message/779092#779092
--------------------------------------------------------------
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
[https://community.jboss.org/message/779092#779092]
Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20121129/f7502a38/attachment.html
More information about the jboss-dev-forums
mailing list