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.
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer
You did not specify a context path or docBase in your Context xml file. Without them, there's no way for the server to match a specific webapp with a specific context definition.
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer
This will make the web application "myapp" be addressable by the URL http://myserver/myapp and use the exploded WAR directory /home/timh/workspace/myapp/target/myapp
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer