Reputation: 215
I've been try to get spring roo generating entities from an oracle database.
However I kept getting the error JDBC driver not available for oracle.jdbc.OracleDriver
I've installed my ojdbc14.jar
to my local maven respository
mvn install:install-file -Dfile=ojdbc14.jar -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.2 -Dpackaging=jar -DgeneratePom=true
I've check my pom.xml and it points to the correct version and when I mvn clean install it compiles correctly.
I'm not sure what I'm missing. I've had it work using MySql but no job with Oracle.
What am I doing wrong ?
Roo version 1.2.2.RELEASE
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.2</version>
<classifier />
</dependency>
....
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.2</version>
</dependency>
#Updated at Tue Nov 13 22:43:01 NZDT 2012
#Tue Nov 13 22:43:01 NZDT 2012
database.driverClassName=oracle.jdbc.OracleDriver
database.url=jdbc\:oracle\:thin\:@[server.ip]\:1521\:orcl
database.username=MYUSER
database.password=MYPASSWORD
Where [server.ip] is the databases ip address
Hi,
I didn't do anything with OSGI.
After downloading the jar you mentioned. (Downloaded it from here http://www.java2s.com/Code/Jar/b/DownloadbizaQutebndjar.htm)
I ran the command you gave me but it produced an error.
oracle/sql/converter_xcharset lx20001.glb lx20002.glb lx2001f.glb lx200b2.glb
One error 1 : Unresolved references to [javax.naming, javax.naming.directory, javax.naming.spi, javax.net, javax.net.ssl, javax.resource, javax.resource.spi, javax.resource.spi.endpoint, javax.resource.spi.security, javax.security.auth, javax.security.cert, javax.sql, javax.sql.rowset, javax.sql.rowset.spi, javax.transaction.xa, javax.xml.parsers, oracle.i18n.text.converter, oracle.ons, oracle.security.pki, org.w3c.dom, org.xml.sax, org.xml.sax.helpers] by class(es) on the Bundle-Classpath[Jar:ojdbc14.jar]: [oracle/jdbc/pool/OracleConnectionCacheManager$1.class, oracle/jdbc/rowset/OracleCachedRowSetReader.class, oracle/jdbc/pool/OracleRuntimeLoadBalancingEventHandlerThread$1.class, oracle/jdbc/rowset/OracleWebRowSet.class, oracle/jdbc/internal/OracleConnection.class, oracle/jdbc/connector/OracleManagedConnectionMetaData.class, oracle/jdbc/xa/OracleXAConnection.class, oracle/jdbc/xa/OracleXAException.class, oracle/jdbc/xa/OracleXADataSource.class, oracle/jdbc/pool/OracleOCIConnectionPool.class, oracle/jdbc/connector/OracleConnectionManager.class, oracle/jdbc/rowset/OracleJDBCRowSet.class, oracle/net/nt/TcpsConfigure.class, oracle/jdbc/rowset/OraclePredicate.class, oracle/jdbc/pool/OracleRuntimeLoadBalancingEventHandlerThread.class, oracle/jdbc/connector/OracleResourceAdapter.class, oracle/jdbc/pool/OracleConnectionCacheTimeOutThread.class, oracle/net/jndi/CustomSSLSocketFactory.class, oracle/jdbc/rowset/OracleRowSetMetaData.class, oracle/jdbc/driver/T4CXAResource.class, oracle/jdbc/rowset/OracleFilteredRowSet.class, oracle/jdbc/xa/OracleXid.class, oracle/jdbc/rowset/OracleWebRowSetXmlWriter.class, oracle/jdbc/rowset/OracleJoinable.class, oracle/jdbc/pool/OracleConnectionCacheImpl.class, oracle/jdbc/connector/OracleManagedConnectionFactory.class, oracle/jdbc/pool/OracleFailoverEventHandlerThread$1.class, oracle/sql/converter/CharacterConverterFactoryOGS.class, oracle/jdbc/pool/OracleConnectionEventListener.class, oracle/jdbc/rowset/OracleWebRowSetXmlReaderImpl.class, oracle/jdbc/pool/OracleXAConnectionCacheImpl.class, oracle/jdbc/rowset/OracleWebRowSetXmlWriterImpl.class, oracle/jdbc/driver/PhysicalConnection.class, oracle/jdbc/xa/client/OracleXADataSource.class, oracle/net/jndi/TrustManagerSSLSocketFactory.class, oracle/jdbc/xa/client/OracleXAResource.class, oracle/jdbc/xa/OracleXAResource.class, oracle/jdbc/pool/OracleConnectionCacheEventListener.class, oracle/jdbc/rowset/OracleRowSetListenerAdapter.class, oracle/jdbc/rowset/OracleWebRowSetXmlReaderDomHandler.class, oracle/jdbc/connector/OracleConnectionRequestInfo.class, oracle/jdbc/pool/OracleDataSourceFactory.class, oracle/net/jndi/JndiAttrs.class, oracle/jdbc/rowset/OracleJoinRowSet.class, oracle/jdbc/rowset/OracleWebRowSetXmlReader.class, oracle/jdbc/xa/client/OracleXAHeteroConnection.class, oracle/jdbc/driver/T4CXAConnection.class, oracle/net/nt/CustomSSLSocketFactory.class, oracle/net/nt/TcpsNTAdapter.class, oracle/jdbc/rowset/OracleCachedRowSetWriter.class, oracle/jdbc/rowset/OracleCachedRowSet.class, oracle/jdbc/pool/OraclePooledConnection.class, oracle/jdbc/pool/OracleFailoverEventHandlerThread.class, oracle/jdbc/xa/client/OracleXAConnection.class, oracle/jdbc/pool/OracleConnectionPoolDataSource.class, oracle/jdbc/driver/LogicalConnection.class, oracle/jdbc/pool/OracleConnectionCacheManager.class, oracle/jdbc/rowset/OracleRowSet.class, oracle/jdbc/pool/OracleImplicitConnectionCache.class, oracle/jdbc/connector/OracleManagedConnection.class, oracle/jdbc/pool/OracleConnectionCache.class, oracle/jdbc/xa/client/OracleXAHeteroResource.class, oracle/jdbc/driver/OracleDriver.class, oracle/jdbc/rowset/OracleWebRowSetXmlReaderContHandler.class, oracle/jdbc/connector/OracleLocalTransaction.class, oracle/net/jndi/TrustManager.class, oracle/jdbc/pool/OracleDataSource.class]
So I didn't get the expected result.
Any idea on this ?
Thanks for the help.
Upvotes: 0
Views: 3471
Reputation: 1682
Did you create an Oracle JDBC driver (ojdbc) for OSGI? From Roo docs:
currently there are no open-source JDBC drivers for Oracle or DB2 and Roo does not provide OSGi drivers for these databases.
You can follow instructions in the given docs. Otherwise, the biz.aQute.bnd.jar helps you to create an OSGi bundle version of the OJDBC driver.
To do that download this zip file and unzip it. Then in the same folder put your ojdbc14.jar and run the command:
java -jar biz.aQute.bnd.jar wrap ojdbc14.jar
I get one warning (Superfluous export-package instructions: [oracle.net, oracle, oracle.jpub, oracle.security, oracle.core]) which I ignore.
As a result of this step you should get a new file: ojdbc14.bar
Rename it whatever you want but with .jar extension. e.g. 'ojdbc14-osgi.jar'
Install the jar in roo with
roo> osgi start --url file:///tmp/ojdbc14-osgi.jar
roo> database reverse engineer ... and so on
Just one thing to note. Remember to edit the version of the ojdbc14 artifactId in the Roo generated pom.xml if necessary.
Hope it helps. I have done it with 3 projects and 3 databases without problems.
Upvotes: 1
Reputation: 24606
If you are getting the error during running with mvn jetty:run
, or mvn tomcat:run
you can try adding the dependency to the tomcat and jetty config:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<httpsPort>9443</httpsPort>
</configuration>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.2</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.4.v20120524</version>
<configuration>
<webAppConfig>
<contextPath>/${project.name}</contextPath>
</webAppConfig>
</configuration>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.2</version>
</dependency>
</dependencies>
</plugin>
Upvotes: 0