Announcement Announcement Module
No announcement yet.
Using database introspection with DB2 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using database introspection with DB2


    I am new to Spring Roo and am looking into it to see if it would be useful for an upcoming project. I would like to use the database introspection add on to generate the entities. From the documentation I have read, in order to accomplish this I need to convert the db2jcc4.jar to osgi. I found some posts on this subject. However, I am running into issues in doing the maven bundle:bundle. The errors I am getting are posted below. I have tried to google this issue, but have not found any resolution. Does anyone know how I can resolve this problem?

    I have been following in order to use introspection with DB2. Specifically:
    1. I created a wrapper project
    2. I started roo and ran the following command (consequently, I renamed the existing pom.xml first as it initially complained that it already existed): addon create wrapper --topLevelPackage --groupId --artifactId db2jcc4 --version 9.7.2 --vendorName IBM --licenseUrl
    3. I editied the pom.xml to include the following line:
    Import-Package>*;resolution:=optional,co*;resolution:=optional,javax.*;res olution:=optional,org.wc.*;resolution:=optional,or g.xml.*;resolution:=optional,sqlj.*;resolution:=op tional,org.ietf.jgss;resolution:=optional,sun.*;re solution:=optional</Import-Package>
    4. I did a maven bundle:bundle - I understand this step should create the osgi jar for db2. I am getting errors on this step

    5. Once step four is complete, I should be able to run: osgi start --url file:///tmp/org.springframework.roo.wrapping.db2jcc4-
    5. Setup persistence: persistence setup --provider HIBERNATE --database DB2_EXPRESS_C
    6. Now should be able to run the database introspect and database reverse engineer commands

    === here are the errors I am getting from running maven bundle:bundle ======
    mvn bundle:bundle
    [INFO] Scanning for projects...
    [WARNING] POM for 'biz.aQute:bndlibom:1.15.0:runtime' is invalid.

    Its dependencies (if any) will NOT be available to the current build.
    [INFO] ------------------------------------------------------------------------
    [INFO] Building com-ibm-db2-roo-jdbc
    [INFO] task-segment: [bundle:bundle]
    [INFO] ------------------------------------------------------------------------
    [INFO] Unable to find resource '' in repository central (
    [INFO] Unable to find resource '' in repository central (
    [INFO] [bundle:bundle {execution: default-cli}]
    [WARNING] Warning building bundle bundle: : Split package META-INF
    Use directive -split-package:=(merge-first|merge-last|error|first) on Export/Private Package instruction to get rid of this warning
    Package found in [Jar:db2jcc4, Jar:db2jcc_license_cu]
    Reference from C:\Documents and Settings\i026526\.m2\repository\com\ibm\db2\db2jcc _license_cu\1.3.1\db2jcc_license_cu-1.3.1.jar
    Classpath [Jar:db2jcc4, Jar:db2jcc_license_cu]
    [ERROR] Error building bundle bundle: : Unresolved references to [,] by class(es) on the Bundle-Classpath[Jar:dot]: [com/ibm/db2/jcc/t2zos/i.class, com/ibm/d
    [ERROR] Error(s) found in bundle configuration
    [INFO] ------------------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] Error(s) found in bundle configuration

    [INFO] ------------------------------------------------------------------------
    [INFO] For more information, run Maven with the -e switch
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 3 seconds
    [INFO] Finished at: Sun May 22 17:14:23 EDT 2011
    [INFO] Final Memory: 9M/21M
    [INFO] ------------------------------------------------------------------------
    C:\Documents and Settings\i026526\Documents\workspace-sts-2.6.1.RELEASE\wrapper>

    ======= Here is my pom for the wrapper project ================

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
    <description>This bundle wraps the standard Maven artifact: ${pkgArtifactId}-${pkgVersion}.</description>

    <id>Google Code</id>
    <Bundle-Vendor>${pkgVendor} (wrapped into an OSGi bundle by the Spring Roo project build system)</Bundle-Vendor>
    <Import-Package>*;resolution:=optional,co*;resolution:=optional,javax.*;res olution:=optional,org.w3c.*;resolution:=optional,o rg.xml.*;resolution:=optional,sqlj.*;resolution:=o ptional,org.ietf.jgss;resolution:=optional,sun.*;r esolution:=optional</Import-Package>

  • #2
    I think this is your problem:

    Originally posted by greenek View Post
    [INFO] Unable to find resource '' in repository central (

    As far as i know, the only legal way to get IBM's DB2 jdbc driver is from IBM itself. You can download the Express-C version of the database for free (google "download ibm db2"), and that's the easiest way to get the driver. Once you have db2jcc4.jar, you need to put it into your local Maven repository:

    mvn install:install-file -Dfile=db2jcc4.jar -DartifactId=db2jcc4 -Dversion=9.7.2  -Dpackaging=jar -DgeneratePom=true
    and the rest should work as described.


    • #3
      Thanks for your response. I tried that. The issue I believe is that some classes in db2jcc4.jar import ibm.zos.batch classes such as DSynchronization. These classes are not included in this jar nor any other jar included in the db2express installation.

      For now, I am going to plan B, which is to generate the entity beans and have spring roo generate the schema. Hopefully osgi drivers are not required for that.


      • #4
        Which version of db2jcc4.jar do you use?

        The ImportPackage element in the pom is meant to resolve just that type of issue. You might try to add*;resolution:=optional to the list.


        • #5
          Thanks!!! That was it. I added that import and now I got the entities to generate. Thanks much!