前言
在开发过程中,使用tomcat配置jndi数据源出现异常, 因此决定研究下具体的工作原理
一、准备
1、下载tomcat源码, 并运行起来;具体操作可以参考Tomcat源码编译运行(作者:_WWWZP)实测可用;
2、配置server.xml和context.xml文件,参考如下:
server.xml:
context.xml:
2、有一个简单的项目(可以用如下代码模拟获取dataSource), 部署在tomcat上;
public static void main(String[] args) throws NamingException {
Hashtable<String, String> hashTable = new Hashtable