开发者社区 问答 正文

spring 配置jndi 报错 Cannot create JDBC driver of class '' for connect URL 'null'"

Spring 配置jndi
我的代码如下,首先tomcat配置jndi
1、tomcat lib包下引入连接mysql数据库驱动
2、在tomcat config 下的content.xml下配置全局数据库信息
screenshot
3、项目web.xml 配置引入数据源信息
screenshot
4、在spring applicationContent.xml中配置dataSource
screenshot
5、在项目的METE-INF下面创建content.xml,信息如下
screenshot
项目启动 不报错,但是我请求http://localhost:8080/hello-mybatis/hello/test.do

报错: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'] with root cause

代码如下
screenshot
我可以确认我的配置信息是正确的,url、user、password、driver都正确

展开
收起
落地花开啦 2016-06-03 16:10:25 4050 分享 版权
1 条回答
写回答
取消 提交回答
  • 喜欢技术,喜欢努力的人

    在content.xml中配置数据源,在web中引用,然后在applicationContent引入dataSource就可以了

    2019-07-17 19:26:47
    赞同 展开评论