tomcat-maven-plugin数据源配置问题

根据google出的文章,在src/main/resources/下建了contextFile.xml并在其中配置了数据源,然后在web.xml中做了如下引用


ConnectionPool DataSource Reference
sysDS
javax.sql.DataSource
Container

启动报如下错误

nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'

中间的解决过程就省略了,摸索出如下解决方法

在pom.xml中做如下的配置


lgn


org.codehaus.mojo
tomcat-maven-plugin
1.1

src/main/resources/contextFile.xml



com.oracle
ojdbc
10.2.0.5




其中ojdbc是需要自己配置到nexus的私服中的

一定要指定contextFile文件位置,google出的很多文章中介绍的时候没指出这点

web.xml中的resource-ref配置在我的环境中不配置也可以,我就去掉了,正因为有了这个配置而tomcat又没正确加载数据源才报了如上的错误,我理解应该是引用错误吧,如果不加resource-ref配置,就会报找不到数据源的错误,可能朝这个方向解决错误更好解决点,其实用不用是不是配resource-ref跟用不用maven也没关系,只是在maven中使用tomcat很多配置都要在插件配置中用configuration配置

你可能感兴趣的:(tomcat-maven-plugin数据源配置问题)