spring-roo

JDBC driver not available for 'org.postgresql.Driver' on Spring Roo


I am trying to use database reverse engineer... See full Roo v1.3 script and UBUNTU env at this simple "hello" script.

The error:

Located add-ons that may offer this JDBC driver
2 found, sorted by rank; T = trusted developer; R = Roo 1.3 compatible
ID T R DESCRIPTION -------------------------------------------------------------
01 Y Y 9.1.0.901-1_0001 Postgres #jdbcdriver...
02 Y Y 9.1.0.901_0001 Postgres #jdbcdriver...
--------------------------------------------------------------------------------
[HINT] use 'addon info id --searchResultId ..' to see details about a search result
[HINT] use 'addon install id --searchResultId ..' to install a specific search result, or
[HINT] use 'addon install bundle --bundleSymbolicName TAB' to install a specific add-on version
JDBC driver not available for 'org.postgresql.Driver'

NOTES

This is a variation of the spring.io/spring-roo fast guide 10 lines example. Very simple...

It was after (and work fine) project and database Roo initializations,

project --topLevelPackage   com.testRoo1Hello2pg
jpa setup --provider HIBERNATE --database POSTGRES --databaseName hello2db --userName postgresql --password postgres

The database.properties seems:

database.driverClassName=org.postgresql.Driver
database.url=jdbc\:postgresql\://localhost\:5432/hello2db
database.username=postgresql
database.password=postgres

spring.jpa.hibernate.naming.strategy=org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.hibernate.ddl-auto=create-drop

The command that fails is:

database reverse engineer --schema public --includeTables "test1"

See roo1/hello3pg.md for more details.


Solution

  • The message that the Spring Roo shell is showing you is not an error. Let's check it:

    Located add-ons that may offer this JDBC driver
    2 found, sorted by rank; T = trusted developer; R = Roo 1.3 compatible
    ID T R DESCRIPTION -------------------------------------------------------------
    01 Y Y 9.1.0.901-1_0001 Postgres #jdbcdriver...
    02 Y Y 9.1.0.901_0001 Postgres #jdbcdriver...
    --------------------------------------------------------------------------------
    [HINT] use 'addon info id --searchResultId ..' to see details about a search result
    [HINT] use 'addon install id --searchResultId ..' to install a specific search result, or
    [HINT] use 'addon install bundle --bundleSymbolicName TAB' to install a specific add-on version
    JDBC driver not available for 'org.postgresql.Driver'
    

    This message appears after execute the database reverse engineer --schema public --includeTables "test1" commands.

    Spring Roo is trying to connect Postgres database but.. oh oh... there's not exists a JDBC Driver for the Postgres database deployed in the OSGi context (remember that Spring Roo works under OSGi environment), so it's not possible to connect with the DB.

    Spring Roo shell is offering you some options to resolve the problem above. So, if your read the message, you could check that you are able to use the following command to install the Postgres JDBC driver into the OSGi context.

    addon install bundle --searchResultId 01
    

    (01 id is the number under the ID column)

    After execute the command to install the OSGi bundle, try to execute the reverse engineer command again.

    That should work!

    Hope it helps,

    NOTE: If you are interested in know more about OSGi and the Apache Felix implementation you could read http://felix.apache.org/ and https://www.osgi.org/developer/specifications/