I'm trying to add a BasicDataSource to a new LocalContainerEntityManagerFactoryBean. When I create the new dataSource like so:
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:http://postgresql_postGISlocalhost:5432/database" />
<property name="username" value="XXXXX" />
<property name="password" value="XXXXX" />
</bean>
And add it to the entitiyManagerFactory
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
</bean>
The error I'm getting is that it's can't find the JDBC driver:
[org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure] HHH000342: Could not obtain connection to query metadata : Cannot load JDBC driver class 'org.postgresql.Driver'
I have the jar being loaded via maven:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.3-1103-jdbc3</version>
</dependency>
and mavens added to my classpath
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
So I'm wondering what am I missing? I can see that the driver is available from the maven dependencies library, but it never finds it when starting up. Any ideas would be much appreciated.
Aucun commentaire:
Enregistrer un commentaire