You should only put the datasource in server.xml if you intend to make it available to multiple webapps as a common definition. Otherwise, set up a context xml file in CATALINA_HOME/conf/Catalina/localhost for the specific webapp that uses it. Alternatively, you can create a META-INF/context.xml file and store it in your WAR.
Here's one I have embedded in an application Context:
I have a web.xml entry to go with it - and that may be what you're missing.
I then use the JDNI key java:/comp/env/jdbc/myDS to locate it.
An IDE is no substitute for an Intelligent Developer.
Joined: Nov 25, 2008
here i change my project as below.now my classes are like these.