2017-09-26 41 views
0

我想将我的JSF Web应用程序连接到PostgreSQL数据库。在GitHub中有通过Maven的ActiveJDBC连接的例子。 Maven插件是这样的:Maven + Web应用程序中的Pgsql配置文件

<plugin> 
<groupId>org.javalite</groupId> 
<artifactId>db-migrator-maven-plugin</artifactId> 
<version>${activejdbc.version}</version> 
<configuration> 
    <configFile> 
${project.basedir}/src/main/resources/database.properties 
    </configFile> 
    <environments>${environments}</environments> 
</configuration> 
<dependencies> 
    <dependency> 
     <groupId>postgresql</groupId> 
     <artifactId>postgresql</artifactId> 
     <version>9.1-901.jdbc4</version> 
    </dependency> 
</dependencies> 
</plugin> 

而且,我的database.properties文件如下:

development.driver=org.postgresql.Driver 
development.username=postgres 
development.password=**** 
development.url=jdbc:postgresql://localhost:5432/first 

当我运行控制台的Java,它完美的作品,但是当我尝试运行Tomcat服务器和Web应用程序,服务器给我错误:

Caused by: org.javalite.activejdbc.DBException: Could not find configuration in a property file for environment: development. Are you sure you have a database.properties file configured?

enter image description here

回答

相关问题