Page 3 of 6 FirstFirst 12345 ... LastLast
Results 21 to 30 of 54

Thread: DBRE - Null pointer

  1. #21
    Join Date
    Oct 2005
    Posts
    8

    Default

    After adding dependencies into pom.xml in your project, run 'mvn dependency:resolve' command. This will download all dependencies into your local Maven repository (by default ~/.m2/repository). Now copy files Alan listed from your local Maven repository into roo/bundle folder.

    Quote Originally Posted by peterg View Post
    How do I retrieve the referenced files?

    Also would I want to substitute the Oracle 11g driver for the Spring Oracle 10 driver?

  2. #22
    Join Date
    Aug 2010
    Posts
    2

    Default

    could you give a hint on what dependencies + bundled files are needed to reverse engineer a a MS-SQL Database ?

    with
    - MSSQL JDBC

    i really could use some help on this

  3. #23
    Join Date
    Sep 2010
    Posts
    11

    Default MSSQL dbre introspect

    Hello All...great forum.

    I second the request for a helping spoon-feed for dbre-introspecting MSSQL. By the way, has anyone had success using the dbre addon over a jtds driver?

    Since I'm new to maven (not Spring), I'm willing to suspect user error in my case in rediscovering the now well-known and dreaded result:

    "No Spring Roo add-ons were found that offer a similar JDBC driver
    JDBC driver not available for 'net.sourceforge.jtds.jdbc.Driver'"

    However, after following (well, perhaps not) the documentation and forum posts, the process seems to result in the driver dependency somehow not being roped in properly.

    It was mentioned that OSGI-enabled driver was necessary...is JTDS one such? I noticed the following in the roo M3 bundle

    org.springframework.roo.wrapping.jtds-1.2.4.0001.jar

    along with jtds-1.2.4.jar. The presence of these in the roo bundle seems indicative of *something* happening w/r/t the jdbc driver, but what specifically? These are in the roo bundle following the attempts to create a project, setup persistence provider and database properties (IIRC, I manually added jtds <dependency> since roo didn't seem to update pom.xml, etc.), and finally running 'dbre introspect --schema myschema'.

    If there are takers, I can provide all necessary details but note that I'm using the roo M3 download (tried roo-dev M3, and roo M2 in sts 2.3.3.M2) and

    mvn -version

    Apache Maven 2.2.1 (r801777; 2009-08-06 14:16:01-0500)
    Java version: 1.6.0_20
    Java home: /usr/lib64/jvm/java-1.6.0-sun-1.6.0/jre
    Default locale: en_US, platform encoding: UTF-8
    OS name: "linux" version: "2.6.27.42-0.1-xen" arch: "amd64" Family: "unix"


    Thanks,
    James

    Quote Originally Posted by kostaroo View Post
    could you give a hint on what dependencies + bundled files are needed to reverse engineer a a MS-SQL Database ?

    with
    - MSSQL JDBC

    i really could use some help on this

  4. #24
    Join Date
    Dec 2005
    Posts
    935

    Default

    The org.springframework.roo.wrapping.jtds-1.2.4.0001.jar is supplied by Roo and so it should work out of the box. Type osgi ps and you should see a line like this

    Code:
    [  68] [Active     ] [    1] Spring Roo - Wrapping - jtds (1.2.4.0001)
    Last edited by Alan Stewart; Sep 1st, 2010 at 06:54 PM.
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  5. #25
    Join Date
    Sep 2010
    Posts
    11

    Default

    Thanks very much for taking the time...

    The 'osgi ps' output does show similar...

    [ 66] [Active ] [ 1] Spring Roo - Wrapping - jtds (1.2.4.0001)

    though I'm not sure what to make of the the following (if anything), since I'm using M3:

    [ 68] [Active ] [ 1] Spring Roo - Shell (Eclipse Implementation) (1.1.0.M2)

    I just downloaded STS 2.0.5.M3 (thanks!) and ran the following roo session, all in the IDE. It appears that I still haven't informed roo how to find the jdbc driver. Are there additional commands or manual machinations necessary to dbre introspect?

    Regards,
    James
    ---------------------------

    roo> persistence setup --provider HIBERNATE --database MSSQL
    Managed SRC_MAIN_RESOURCES/META-INF/spring/applicationContext.xml
    Created SRC_MAIN_RESOURCES/META-INF/persistence.xml
    Please enter your database details in src/main/resources/META-INF/spring/database.properties.
    Created SRC_MAIN_RESOURCES/META-INF/spring/database.properties
    Managed ROOT/pom.xml [Added dependency net.sourceforge.jtds:jtds:1.2.4]
    ...[removed]
    roo> database properties set --key database.driverClassName --value net.sourceforge.jtds.jdbc.Driver
    Managed SRC_MAIN_RESOURCES/META-INF/spring/database.properties
    roo> database properties set --key database.url --value jdbc:jtds:sqlserver://sqlserver:1433/dbName;useCursors=true
    Managed SRC_MAIN_RESOURCES/META-INF/spring/database.properties
    roo> database properties set --key database.username --value sa
    Managed SRC_MAIN_RESOURCES/META-INF/spring/database.properties
    roo> database properties set --key database.password --value sapass
    Managed SRC_MAIN_RESOURCES/META-INF/spring/database.properties
    roo> database introspect --schema dbo
    No Spring Roo add-ons were found that offer a similar JDBC driver
    JDBC driver not available for 'net.sourceforge.jtds.jdbc.Driver'

    roo> osgi ps
    START LEVEL 99
    ID State Level Name
    [ 0] [Active ] [ 0] System Bundle (2.0.4)
    ...[removed]
    [ 13] [Active ] [ 1] Spring Roo - Addon - Database Reverse Engineering
    ...[removed]
    [ 68] [Active ] [ 1] Spring Roo - Shell (Eclipse Implementation) (1.1.0.M2)

  6. #26
    Join Date
    Dec 2005
    Posts
    935

    Default

    Do your unit tests and/or web app make a connection to your DB OK, with the properties in your database.properties? DBRE uses the same database.properties to make a connection to the live DB.

    After jumping through all the hoops on the Microsoft site, my trial version of MS SQL 2008 is finally downloading now, so give me a couple of days to install this in a VM and to see if I can connect to it.

    Alan
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  7. #27
    Join Date
    Sep 2010
    Posts
    11

    Default

    Unit test via 'perform tests' fails on a simple entity having one field (entity, controllers, scaffolding, all look good):

    -------------------------------------------------------
    T E S T S
    -------------------------------------------------------
    Running com.blah.FirstPassIntegrationTest
    2010-09-02 22:07:53,064 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaValidator - could not get database metadata
    org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'net.sourceforge.jtds.jdbc.Driver'
    ERROR org.hibernate.util.JDBCExceptionReporter - Cannot load JDBC driver class 'net.sourceforge.jtds.jdbc.Driver'
    Tests run: 9, Failures: 0, Errors: 8, Skipped: 0, Time elapsed: 2.992 sec <<< FAILURE!
    Results :

    Sorry about the SQL Server run-around and thanks for that. If, for some reason, it becomes too much of a distraction, let me know and I'll see if can get an open port and database for you to test against, temporarily.

    - James

  8. #28
    Join Date
    Dec 2005
    Posts
    935

    Default

    I was able to hook up to a Sybase server which uses the same jTDS driver and am having similar issues with unit tests and dbre, so I don't think it's a MSSQL specific issue. Will let you know
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  9. #29
    Join Date
    Jun 2010
    Posts
    17

    Default Solved

    The following line in .../addon-jdbc/pom.xml:

    <Import-Package>*,net.sourceforge.jtds.jdbc;resolution:=op tional,com.mysql.jdbc;resolution:=optional,org.apa che.derby.jdbc;resolution:=optional,oracle.jdbc;re solution:=optional,org.h2;resolution:=optional,org .hsqldb;resolution:=optional,org.postgresql;resolu tion:=optional</Import-Package>


    ...must be changed to:

    <Import-Package>*,net.sourceforge.jtds;resolution:=optiona l,com.mysql.jdbc;resolution:=optional,org.apache.d erby.jdbc;resolution:=optional,oracle.jdbc;resolut ion:=optional,org.h2;resolution:=optional,org.hsql db;resolution:=optional,org.postgresql;resolution: =optional</Import-Package>


    Basically, we were referring to 'net.sourceforge.jtds' instead of 'net.sourceforge.jtds.jdbc'

    I hope this helps.

    -Mdu

  10. #30
    Join Date
    Dec 2005
    Posts
    935

    Default

    Did you mean that it has to be changed to <Import-Package>*,net.sourceforge.jtds.jdbc ....?
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •