Tomcat¶
Tomcat offers no out-of-the-box way to create a Properties resource. One solution is to download the propfactory jar from the shredzone.org Maven repository and place it in Tomcat's lib directory. It offers an SPI that creates a java.util.Properties object using the given ResourceParams.
A context.xml file for RepoWatch could now look like this:
<Context>
<Resource name="jdbc/RepowatchDS"
auth="Container"
type="javax.sql.DataSource"
url="jdbc:postgresql://localhost:5432/repowatch"
driverClassName="org.postgresql.Driver"
username="repowatch"
password="secret" />
<Resource name="hibernate/RepowatchDS"
auth="Container"
type="java.util.Properties"
factory="org.shredzone.PropertiesFactory"/>
<ResourceParams name="hibernate/RepowatchDS">
<parameter>
<name>hibernate.dialect</name>
<value>org.hibernate.dialect.PostgreSQLDialect</value>
</parameter>
<parameter>
<name>hibernate.hbm2ddl.auto</name>
<value>update</value>
</parameter>
</ResourceParams>
</Context>
After deploying the RepoWatch WAR file (e.g. from the shredzone.org Maven repository), RepoWatch should be running.