2014-03-01 44 views
3

我有一个多模块Maven项目,我想与tomcat7行家使用插件,并启动它:行家tomcat7:运行配置数据源

mvn tomcat7:run 

但我无法弄清楚如何配置一个jndi数据源。
我试图把我的的pom.xml

<plugin> 
    <groupId>org.apache.tomcat.maven</groupId> 
    <artifactId>tomcat7-maven-plugin</artifactId> 
    <version>2.0</version> 
    <configuration> 
      <contextFile>tomcat/context.xml</contextFile> 
    </configuration> 
</plugin> 

,并在context.xml中

<?xml version="1.0" encoding="UTF-8"?> 
<Context> 
    <Resource name="jdbc/AppealDS" url="jdbc:hsqldb:file:database/appeal" 
     driverClassName="org.hsqldb.jdbcDriver" username="appeal" 
     password="appeal" auth="Container" type="javax.sql.DataSource" 
     maxActive="3" maxIdle="2" maxWait="10000" /> 
</Context> 

但它不工作...如何我注册了jndi数据源?

回答

1

什么是错误信息? 用途:

<plugin> 
<groupId>org.apache.tomcat.maven</groupId> 
<artifactId>tomcat7-maven-plugin</artifactId> 
<version>2.2</version> 
<configuration> 
     <contextFile>tomcat/context.xml</contextFile> 
</configuration> 
</plugin> 

也许你的JDBC驱动程序无法在类路径?

尝试增加他的插件依赖性

<plugin> 
<groupId>org.apache.tomcat.maven</groupId> 
<artifactId>tomcat7-maven-plugin</artifactId> 
<version>2.2</version> 
<configuration> 
     <contextFile>tomcat/context.xml</contextFile> 
</configuration> 
<dependencies> 
    <dependency> 
    here your hsql version 
    </dependency> 
</dependencies> 
</plugin> 
+2

我有一个问题,当应用程序试图得到它...它抛出一个异常说taht的* JDBC/*无法找到... – rascio