-
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
-
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)
-
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
-
Oracle
Yes i did update the pom to have the oracle driver but not clear what else is missing from the error message
-
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
-
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
-
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
-
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.
-
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.0:provided
[INFO] javax.servlet:servlet-api:jar:2.5:provided
[INFO] javax.transaction:com.springsource.javax.transacti on:jar:1.1.0:provided
[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.M3:provided
[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)
-
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