我想將我的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?
謝謝您的回答 –