Unlike Tomcat, weblogic creates multiple servers (Usually an Admin Server, plus at least one other). Each server has to be allocated the data source. In a clustered environment, you need to apply the datasource to the cluster servers.
- Log into the Weblogic console, and check the datasource JNDI name (don't confuse this with the datasource name, which is purely to keep the console listing looking pretty). The JNDI name should be something like jdbc/MyDB
- Check the datasource Targets tab, and make sure it is applied to the server/cluster you are going to deploy your web app to.
- Restart Weblogic. I find that data sources sometimes need this before they become visible to application code.
- Deploy your web app to the correct server/cluster.
You should be to connect to the datasource as normal. I always use a Spring JNDI bean, so I can't help with the exact syntax. The suggestions by @Maas look good.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…