Announcement Announcement Module
No announcement yet.
New Roo script for JDBC driver installation for DBRE Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • New Roo script for JDBC driver installation for DBRE

    I have created a Roo script to install the OSGi JDBC drivers for use with DBRE which we don't ship because of their size. It will be part of the upcoming 1.1.0.RELEASE. To use, just type:

    roo> script --file install-jdbc-drivers.roo
    And restart the shell. This is a one-time only installation.

    IMPORTANT: A small hiccup in the script may cause an issue: I used osgi install commands rather than osgi start commands. When the Roo shell is restarted, the bundles appear in the Resolved state, rather than Active. Though, on my system it does not appear to affect the operation of the drivers for DBRE. If this does cause an issue with your installations, one can run the script again with osgi start for each of the drivers - the commands will be in log.roo. This will be updated in 1.1.1.

    Last edited by Alan Stewart; Oct 25th, 2010, 07:26 PM.

  • #2
    Great and useful!!

    Alan, do you have any doc that guides us to pack libs as OSGi bundles?

    I have observed the Spring guys do that easily ... any doc will be useful to pack 3rd party add-ons dependencies as bundles, for example CXF.

    Many thanks!!


    • #3
      With a little luck dependencies required for your add-on are already in OSGi bundle format and in Maven Central in that form. This is the ideal world situation. The easiest way to check is to open the manifest and see if it contains import and export package etc entries typical to OSGi. Even if the entires are there, they're not necessarily correct, but at least you're off to a good start.

      In the frequent case a published JAR doesn't contain the required OSGi manifest, you'll need to "wrap" it. Take a look in Roo's "wrapping" directory for an example of how we wrap JARs. If you do wrap a JAR, you then need to publish the new wrapped JAR. Note the new wrapped JAR will have a package name unique to your project, such as as GroupID of com.foobar.myproject.wrapping.somelibrary and an ArtifactID of com.foobar.myproject.wrapping.somelibrary. This therefore offers uniqueness and you can publish the JAR to your own OBR repository. The new add-on creation commands automatically setup Google Code projects completed with your own OBR repository, so use that as a guide.

      Once your have your add-on and its dependencies in your own OBR repository, the final step is to make Roo aware of these so people can install your add-on. We have a magical email address, [email protected], which you simply email the URL to your OBR repository.xml file. RooBot indexes it and keeps an eye on it in the future for updates. It's that easy.

      As a general matter of principle it's good form to avoid your Roo add-on depending on bundles. Try to use the JDK and write utility classes etc. Adding a dependency is usually a lot of trouble and should be reserved for times you simply must have a dependency in the Roo OSGi-enabled shell classpath to do some useful work. For trivial cases, do without the dependency. Remember also all of these remarks apply only to the Roo OSGi shell. None of this is necessary if you're simply wanting to add a dependency to a Roo-created project. There's no OSGi involved in that case.

      I promise we'll document all this sometime soon. The good news is all the complex OSGi-related pieces ahve been figured out and baked into 1.1.0.RELEASE, so it's just a case of educating the community how to use it. We've been so flat out with completing GA we just ran out of time, but we'll address this promptly now.

      Last edited by Ben Alex; Nov 8th, 2010, 04:35 PM. Reason: fixed email address


      • #4
        This is failing due to the proxy server at my corporate location -- is there a way to configure Roo to deal with that proxy server?


        • #5
          +1 proxy for install-jdbc-drivers.roo

          Just to +1 mnehrkorn, I can't work out to get roo running osgi installs through my authenicated proxy either.



          • #6
            Proxy workaround

            I was able to find a workaround to the problem....

            I just downloaded that zip file and then used a file URL to access it for the osgi install.


            • #7
              Here is an example for HSQLDB.
              Download jar manually using url from the script.

              Run install command in Roo shell.
              osgi install --url file:///d:/springsource/workspace/project/org.springframework.roo.wrapping.hsqldb-


              • #8
                Hi Alan
                Could you provide url to DB2 bundle?


                • #9
                  There is no url for DB2. As it is a licensed product we can't host the driver jars in any public repo. There does not appear to be any open source drivers for DB2 either .
                  I haven't had any success yet in wrapping the jars either


                  • #10
                    Thanks Ben,

                    Absolutelly agree!



                    • #11
                      I tried to install the jdbc drivers from with STS. I am getting the following errors. I gather it is because the proxy is not setup.

                      How can you configure proxy in Spring Roo so that it is possible to download the drivers from Roo without having to manually download, save locally and install from there?

                      domain roo> script --file install-jdbc-drivers.roo
                      // Installing OSGi JDBC drivers ...
                      domain roo>
                      domain roo> Connection timed out: connect

                      domain roo> Connection timed out: connect

                      domain roo> Connection timed out: connect

                      domain roo> Connection timed out: connect

                      domain roo> Connection timed out: connect
                      domain roo> Connection timed out: connect


                      • #12
                        Configure the proxy in STS and try again


                        • #13
                          The proxy already is configured in STS (presumably using the Eclipse proxy config settings).

                          I know this is working as I am able to install software within Eclipse and also in STS. For instance I installed the Roo extension within within the STS Dashboard -> Extensions tab.


                          • #14


                            i can't find the "install-jdbc-driver" script... it seems that it has been removed in the last version. What do we have for replacement?

                            I can't make MySQL reverse engineer work (JDBC driver not avalaible)

                            Is there a Jar for mysql to do something like :

                            osgi install --url file:///d:/springsource/workspace/project/org.springframework.roo.wrapping.hsqldb-




                            • #15
                              The script is no longer needed and has been removed in favour of on-demand installation with OSGi. Configure your database properties as you normally would do. There are a couple of ways, but I usually just do a database introspect --schema[TAB} or database reverse engineer --schema[TAB]. You will see that an OSGI-enabled driver is available to download. Note its ID (eg "1") and then execute
                              addon install id --searchId 01
                              The driver will be downloaded, started and then you can reverse engineer from then on. This is a once only step, providing you don't re-install Roo or delete the OSGi bundle cache directory under Roo's directory structure