Bob Frapples wrote:
I implemented this code:
DataSource ds = (DataSource)
new InitialContext().lookup("jdbc/MyDS"); // replace this with your datasource deployed in JBoss
Looks like you are using the datasource configured through Spring beans. I'm not sure how Spring works, but it looks like it creates a proxy to the original datasource. So instead of trying to lookup the spring one, directly lookup the JBoss deployed datasource:
new InitialContext().lookup("java:jdbc/MyDS");
Note the java: prefix. That's the namespace to which JBoss by default deploys the datasources.