YellowSub
YellowSub

Reputation: 179

Spring Roo - 'JDBC driver not available for 'net.sourceforge.jtds.jdbc.Driver'

I am fairly new to Spring Roo and have a problem with establishing a connection to a MSSQL database. I am using Spring Tool Suite and Roo Version 1.3.1. When I try to test the connection to the database (set up with “jpa setup...”) with “database introspect --schema dbo” I get the following error:

        Located add-on that may offer this JDBC driver
        1 found, sorted by rank; T = trusted developer; R = Roo 1.3 compatible
        ID T R DESCRIPTION -------------------------------------------------------------
        01 Y Y 1.2.4.0010 #jdbcdriver driverclass:net.sourceforge.jtds.jdbc.Driver
....
    JDBC driver not available for 'net.sourceforge.jtds.jdbc.Driver'

After that, I tried to install the driver with:

roo> addon install id --searchResultId 01
roo> Target resource(s):
-------------------
   Spring Roo - Wrapping - jtds (1.2.4.0010)

Deploying...
done.

The driver also seems to be present in the addon list:

...
58 Y Y 1.2.4.0010 #jdbcdriver driverclass:net.sourceforge.jtds.jdbc.Driver.
       This bundle wraps the standard Maven artifact: jtds-1.2.4.

But when I try to run the database introspect command again, I still get the above message. As recommended here: http://forum.spring.io/forum/spring-projects/roo/118692-unable-to-find-the-jtds-driver I tried to manually install the file with the command:

osgi start -–url “file:\\\C:\Program Files\Spring Tool Suite\jtds-1.2.4.jar”

but I get the exception

org.osgi.framework.BundleException: Unable to cache bundle: file:\C:Program
        at org.apache.felix.framework.Felix.installBundle(Felix.java:2947)

and the behavior stays the same. I also tried the same with Roo version 2, but there the “database introspect” command seems to be unavailable.

Upvotes: 2

Views: 479

Answers (2)

Tharindu Jayasuriya
Tharindu Jayasuriya

Reputation: 394

Instead of

addon install id --searchResultId 01

Change it to

addon install id --searchResultId 58

Then it will install the JDBC driver after that you should be able to continue with the

database introspect --schema dbo

Upvotes: 2

eruiz
eruiz

Reputation: 1973

In an OSGi container you must install OSGi bundles only, regular JAR files cannot be installed in an OSGi container.

The Spring Roo Wrapping project helps you in this way by wrapping regular JARS as OSGi bundles.

Take a look to Spring Roo Wrapping project in order to wrap the MySQL JDBC driver.

Hope it helps,

Upvotes: 2

Related Questions