I’m trying to pass the tests automatically generated by roo for the entity classes. When I run the tests against hsql, they all pass. But when i run the tests against Oracle, I get the following:
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class ‘oracle.jdbc.driver.OracleDriver’ for connect URL ‘jdbc:localhost:1521:xe’
I have an oracle db local, I know the connection works.
The ojdbc14.jar file is in the lib directory of JBoss 4.2.3/server/all directory (which is where we’re deploying to)
This is the data source bean and entity manager factory definition
<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource">
<property name="driverClassName" value="${database.driverClassName}"/>
<property name="url" value="${database.url}"/>
<property name="username" value="${database.username}"/>
<property name="password" value="${database.password}"/>
<property name="testOnBorrow" value="true"/>
<property name="testOnReturn" value="true"/>
<property name="testWhileIdle" value="true"/>
<property name="timeBetweenEvictionRunsMillis" value="1800000"/>
<property name="numTestsPerEvictionRun" value="3"/>
<property name="minEvictableIdleTimeMillis" value="1800000"/>
</bean><!-- Development specific configuration comes here. -->
<bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory">
<property name="persistenceUnitName" value="${hibernate.persistenceunit}"/>
<property name="dataSource" ref="dataSource"/>
</bean>
This is the pom dependency definition:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.3.0</version>
<classifier/>
</dependency>
The persistenceunit variable resolves to persistenceUnitDev
this is the hibernate definition of that persistence unit
org.hibernate.ejb.HibernatePersistence
And finally my property file that defines the data connection:
database.password=password
database.url=jdbc\:localhost\:1521\:xe
database.username=username
database.driverClassName=oracle.jdbc.driver.OracleDriver
I can’t figure out why it tells me it can’t get a suitable driver.
thanks in advance
Your URL does not have the proper pattern. Try
jdbc:oracle:thin:@localhost:1521:xeinstead.