Announcement Announcement Module
Collapse
No announcement yet.
DBRE - Null pointer Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • DBRE - Null pointer

    Hi,

    I have setup a oracle database and updated the database.properties to point to the database.

    When i run database reverse engineer, i get this

    dbre roo> database reverse engineer --schema app --package ~.entity
    NullPointerException at org.springframework.roo.addon.jdbc.polling.interna l.PollingJdbcDriverManager.findAddOnsOffering(
    PollingJdbcDriverManager.java:73)

    Thanks

  • #2
    Same here:

    db roo> database reverse engineer --package db --schema xxx
    java.lang.NullPointerException
    at org.springframework.roo.addon.jdbc.polling.interna l.PollingJdbcDriverManager.findAddOnsOffering(Poll ingJdbcDriver
    Manager.java:73)
    at org.springframework.roo.obr.internal.AddOnSearchMa nagerImpl.completeAddOnSearch(AddOnSearchManagerIm pl.java:27)
    at org.springframework.roo.addon.jdbc.polling.interna l.PollingJdbcDriverManager.loadDriver(PollingJdbcD riverManager.
    java:66)
    at org.springframework.roo.addon.dbre.jdbc.Connection ProviderImpl.getConnection(ConnectionProviderImpl. java:40)
    at org.springframework.roo.addon.dbre.jdbc.Connection ProviderImpl.getConnection(ConnectionProviderImpl. java:53)
    at org.springframework.roo.addon.dbre.DbreModelServic eImpl.getConnection(DbreModelServiceImpl.java:266)
    at org.springframework.roo.addon.dbre.DbreModelServic eImpl.getDatabase(DbreModelServiceImpl.java:188)
    at org.springframework.roo.addon.dbre.DbreModelServic eImpl.refreshDatabase(DbreModelServiceImpl.java:14 1)
    at org.springframework.roo.addon.dbre.DbreOperationsI mpl.reverseEngineerDatabase(DbreOperationsImpl.jav a:75)
    at org.springframework.roo.addon.dbre.DbreCommands.se rializeDatabaseMetadata(DbreCommands.java:44)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.roo.support.util.ReflectionUti ls.invokeMethod(ReflectionUtils.java:191)
    at org.springframework.roo.process.manager.ProcessMan agerHostedExecutionStrategy$1.callback(ProcessMana gerHostedExec
    utionStrategy.java:49)
    at org.springframework.roo.process.manager.internal.D efaultProcessManager.doTransactionally(DefaultProc essManager.ja
    va:177)
    at org.springframework.roo.process.manager.internal.D efaultProcessManager.execute(DefaultProcessManager .java:140)
    at org.springframework.roo.process.manager.ProcessMan agerHostedExecutionStrategy.execute(ProcessManager HostedExecuti
    onStrategy.java:47)
    at org.springframework.roo.shell.AbstractShell.execut eCommand(AbstractShell.java:159)
    at org.springframework.roo.shell.jline.JLineShell.pro mptLoop(JLineShell.java:327)
    at org.springframework.roo.shell.jline.JLineShell.run (JLineShell.java:120)
    at java.lang.Thread.run(Unknown Source)

    Comment


    • #3
      What database are you using? We don't ship all the JDBC drivers due to their size. You will have to make sure the driver is in your maven repo

      Comment


      • #4
        Oracle

        Yes i did update the pom to have the oracle driver but not clear what else is missing from the error message

        Comment


        • #5
          These dependencies (from addon-jdbc) are required for Oracle:
          Code:
          		<dependency>
          			<groupId>com.oracle.jdbc</groupId>
          			<artifactId>com.springsource.oracle.jdbc</artifactId>
          			<version>10.2.0.2</version>
          		</dependency>
          		<dependency>
          			<groupId>javax.resource</groupId>
          			<artifactId>com.springsource.javax.resource</artifactId>
          			<version>1.5.0</version>
          			<scope>provided</scope>
          		</dependency>
          		<dependency>
          			<groupId>javax.transaction</groupId>
          			<artifactId>com.springsource.javax.transaction</artifactId>
          			<version>1.1.0</version>
          			<scope>provided</scope>
          		</dependency>
          However, I don't like the NPE and will look at this
          Alan

          Comment


          • #6
            well i tried with

            <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc5</artifactId>
            <version>11.2.0.1.0</version>
            <scope>provided</scope>
            </dependency>

            And also what you suggested to have. Still same message
            Also the tab doesn't suggest what properties are needed, maybe still in works

            Comment


            • #7
              Unless your Oracle 11 db driver is OSGi-enabled, it's not going to work as Roo runs in an OSGi container.

              With the dependencies I listed above in my Maven repo, I have tested Oracle XE (10) quite successfully, so I am not sure what to tell you.

              Perhaps you can backup your Roo project and also send me an Oracle schema DDL

              Comment


              • #8
                I added null checks for OBR-related client calls. Though it may not solve your issue, at least you shouldn't get NPEs anymore. Please see ROO-1277.

                I wanted to ask earlier if you were both connected to the Internet when the error occurred? The issue you experienced can be caused by not having a connection.

                Comment


                • #9
                  I'm connected to internet and tried to use dependencies exactly as you posted. Here is output from mvn dependency:resolve

                  [INFO] The following files have been resolved:
                  [INFO] antlr:antlr:jar:2.7.6:compile
                  [INFO] aopalliance:aopalliance:jar:1.0:compile
                  [INFO] cglib:cglib-nodep:jar:2.2:compile
                  [INFO] com.oracle.jdbc:com.springsource.oracle.jdbc:jar:1 0.2.0.2:compile
                  [INFO] commons-collections:commons-collections:jar:3.1:compile
                  [INFO] commons-dbcp:commons-dbcp:jar:1.3:compile
                  [INFO] commons-pool:commons-pool:jar:1.5.4:compile
                  [INFO] dom4j:dom4j:jar:1.6.1:compile
                  [INFO] javassist:javassist:jar:3.9.0.GA:compile
                  [INFO] javax.resource:com.springsource.javax.resource:jar :1.5.0rovided
                  [INFO] javax.servlet:servlet-api:jar:2.5rovided
                  [INFO] javax.transaction:com.springsource.javax.transacti on:jar:1.1.0rovided
                  [INFO] javax.transaction:jta:jar:1.1:compile
                  [INFO] javax.validation:validation-api:jar:1.0.0.GA:compile
                  [INFO] junit:junit:jar:4.8.1:test
                  [INFO] log4j:log4j:jar:1.2.16:compile
                  [INFO] net.sf.flexjson:flexjson:jar:2.0:compile
                  [INFO] org.aspectj:aspectjrt:jar:1.6.10.M1:compile
                  [INFO] org.hibernate:hibernate-annotations:jar:3.5.5-Final:compile
                  [INFO] org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
                  [INFO] org.hibernate:hibernate-core:jar:3.5.5-Final:compile
                  [INFO] org.hibernate:hibernate-entitymanager:jar:3.5.5-Final:compile
                  [INFO] org.hibernate:hibernate-validator:jar:4.1.0.Final:compile
                  [INFO] org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:compile
                  [INFO] org.slf4j:jcl-over-slf4j:jar:1.6.1:compile
                  [INFO] org.slf4j:slf4j-api:jar:1.6.1:compile
                  [INFO] org.slf4j:slf4j-log4j12:jar:1.6.1:compile
                  [INFO] org.springframework:spring-aop:jar:3.0.4.RELEASE:compile
                  [INFO] org.springframework:spring-asm:jar:3.0.4.RELEASE:compile
                  [INFO] org.springframework:spring-aspects:jar:3.0.4.RELEASE:compile
                  [INFO] org.springframework:spring-beans:jar:3.0.4.RELEASE:compile
                  [INFO] org.springframework:spring-context:jar:3.0.4.RELEASE:compile
                  [INFO] org.springframework:spring-context-support:jar:3.0.4.RELEASE:compile
                  [INFO] org.springframework:spring-core:jar:3.0.4.RELEASE:compile
                  [INFO] org.springframework:spring-expression:jar:3.0.4.RELEASE:compile
                  [INFO] org.springframework:spring-jdbc:jar:3.0.4.RELEASE:compile
                  [INFO] org.springframework:spring-orm:jar:3.0.4.RELEASE:compile
                  [INFO] org.springframework:spring-test:jar:3.0.4.RELEASE:test
                  [INFO] org.springframework:spring-tx:jar:3.0.4.RELEASE:compile
                  [INFO] org.springframework.roo:org.springframework.roo.an notations:jar:1.1.0.M3rovided
                  [INFO] xml-apis:xml-apis:jar:1.0.b2:compile

                  and here is
                  roo> database properties list
                  database.driverClassName = oracle.jdbc.OracleDriver
                  database.password = xxx
                  database.url = jdbc:oracle:thin:@127.0.0.1:1521:XE
                  database.username = xxx

                  Now getting following error:

                  db roo> database reverse engineer --package db --schema xxx
                  No Spring Roo add-ons were found that offer a similar JDBC driver
                  JDBC driver not available for 'oracle.jdbc.OracleDriver'
                  java.lang.IllegalArgumentException: JDBC driver not available for 'oracle.jdbc.OracleDriver'
                  at org.springframework.roo.support.util.Assert.notNul l(Assert.java:112)
                  at org.springframework.roo.addon.dbre.jdbc.Connection ProviderImpl.getConnection(ConnectionProviderImpl. java:41)
                  at org.springframework.roo.addon.dbre.jdbc.Connection ProviderImpl.getConnection(ConnectionProviderImpl. java:53)
                  at org.springframework.roo.addon.dbre.DbreModelServic eImpl.getConnection(DbreModelServiceImpl.java:266)
                  at org.springframework.roo.addon.dbre.DbreModelServic eImpl.getDatabase(DbreModelServiceImpl.java:188)
                  at org.springframework.roo.addon.dbre.DbreModelServic eImpl.refreshDatabase(DbreModelServiceImpl.java:14 1)
                  at org.springframework.roo.addon.dbre.DbreOperationsI mpl.reverseEngineerDatabase(DbreOperationsImpl.jav a:75)
                  at org.springframework.roo.addon.dbre.DbreCommands.se rializeDatabaseMetadata(DbreCommands.java:44)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
                  at java.lang.reflect.Method.invoke(Unknown Source)
                  at org.springframework.roo.support.util.ReflectionUti ls.invokeMethod(ReflectionUtils.java:191)
                  at org.springframework.roo.process.manager.ProcessMan agerHostedExecutionStrategy$1.callback(ProcessMana gerHostedExec
                  utionStrategy.java:49)
                  at org.springframework.roo.process.manager.internal.D efaultProcessManager.doTransactionally(DefaultProc essManager.ja
                  va:177)
                  at org.springframework.roo.process.manager.internal.D efaultProcessManager.execute(DefaultProcessManager .java:140)
                  at org.springframework.roo.process.manager.ProcessMan agerHostedExecutionStrategy.execute(ProcessManager HostedExecuti
                  onStrategy.java:47)
                  at org.springframework.roo.shell.AbstractShell.execut eCommand(AbstractShell.java:159)
                  at org.springframework.roo.shell.jline.JLineShell.pro mptLoop(JLineShell.java:327)
                  at org.springframework.roo.shell.jline.JLineShell.run (JLineShell.java:120)
                  at java.lang.Thread.run(Unknown Source)

                  Comment


                  • #10
                    I've only tested with Oracle XE as we don't have an Oracle license for a full version of 10g or 11g. I would appreciate it if you can send me a simple Roo project with an Oracle DDL to stewarta at vmware dot com and I will try to run it.
                    Thanks

                    Comment


                    • #11
                      Oracle XE here as well. I have sent you sample project. Thanks,

                      Comment


                      • #12
                        Identical issue

                        I did successfully add the jar, manually, to my local repository for Oracle 11g. I had a successful test by creating a simple entity with a single field and was able to create an entry in the database via the web app.

                        However, when attempting "database reverse engineer" or "database introspect" I receive the following error inside the roo command line app:

                        No Spring Roo add-ons were found that offer a similar JDBC driver
                        JDBC driver not available for 'oracle.jdbc.OracleDriver'

                        It looks like the classpath used by the roo app also needs to have the Oracle driver added somehow? I am not sure if this is the case, or how to approach it.

                        As a workaround how would I go about leveraging the composite key functionality without reverse engineering a table. I can perform the old method of introspection by manually creating the entities.

                        Thanks,

                        -Pete G

                        Comment


                        • #13
                          Thanks for sending me the project. I will look into it over the weekend. Does the same issue occur if you run Roo from a Git build (ie pulled from master) or just with the downloaded 1.1.0.M3 release?

                          Comment


                          • #14
                            As a workaround how would I go about leveraging the composite key functionality without reverse engineering a table. I can perform the old method of introspection by manually creating the entities.
                            You can create an entity with the --identifierType <some class> which will create a composite key class for you.

                            I suggest you hang in there till I sort out the Oracle driver issue.

                            Comment


                            • #15
                              My apologies as I have just realised that the oracle jar and its dependencies need to be in the Roo bundle directory. Please copy com.springsource.oracle.jdbc-10.2.0.2.jar, com.springsource.javax.transaction-1.1.0.jar, and com.springsource.javax.resource-1.5.0.jar to the Roo distribution's bundle directory. Restart Roo and you should be set to go.

                              We don't package Oracle as the jdbc driver jar is too large. The schema names in Oracle are case sensitive, so when I executed the following command:

                              database instropect --schema DBRE

                              I get:
                              Code:
                              <?xml version="1.0" encoding="UTF-8" standalone="no"?>
                              <database name="" schema="DBRE">
                                  <table name="CONTACT">
                                      <column index="1" name="CNTA_ID" primaryKey="true" required="true" size="22" type="DECIMAL"/>
                                      <column index="2" name="CNTA_NAME_FIRST" primaryKey="false" required="false" size="100" type="VARCHAR"/>
                                      <column index="3" name="CNTA_NAME_LAST" primaryKey="false" required="false" size="100" type="VARCHAR"/>
                                      <unique name="PK_CONTACT">
                                          <unique-column name="CNTA_ID" sequenceNumber="1"/>
                                      </unique>
                                      <exportedKey foreignTable="CONTACT_NOTE" name="FK_CONTACT_NOTE_ID" onDelete="cascade" onUpdate="cascade">
                                          <reference foreign="CNTA_ID" local="CNTA_ID" sequenceNumber="1"/>
                                      </exportedKey>
                                  </table>
                                  <table name="CONTACT_NOTE">
                                      <column index="1" name="CNNO_ID" primaryKey="true" required="true" size="22" type="DECIMAL"/>
                                      <column index="2" name="CNTA_ID" primaryKey="false" required="true" size="22" type="DECIMAL"/>
                                      <column index="3" name="CNNO_TYPE" primaryKey="false" required="true" size="22" type="DECIMAL"/>
                                      <column index="4" name="CNNO_DATE_CREATE" primaryKey="false" required="true" size="7" type="DATE"/>
                                      <column index="5" name="CNNO_DATE_UPDATE" primaryKey="false" required="true" size="7" type="DATE"/>
                                      <column index="6" name="CNNO_COMMENT" primaryKey="false" required="false" size="4000" type="CLOB"/>
                                      <foreignKey foreignTable="CONTACT" name="FK_CONTACT_NOTE_ID" onDelete="cascade" onUpdate="cascade">
                                          <reference foreign="CNTA_ID" local="CNTA_ID" sequenceNumber="1"/>
                                      </foreignKey>
                                      <unique name="PK_CONTACT_NOTE">
                                          <unique-column name="CNNO_ID" sequenceNumber="1"/>
                                      </unique>
                                  </table>
                                  <sequences>
                                      <sequence name="DBRE"/>
                                  </sequences>
                              </database>
                              "DBRE" is my own schema - use yours as appropriate.

                              Hope this helps
                              Alan

                              Comment

                              Working...
                              X