2014-03-01 46 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