DBRE and DB2400
I'm hoping Alan Stewart can help me here. I'm attempting DBRE on my DB2400 datasource. Alan you added support for DB2400 back in August when I showed you there was an open source JDBC driver for it. I hadn't had the chance to fully test DBRE on it before the M3 launch. Anyways, I'm trying it now and I keep getting a message saying the following:
"No Spring Roo add-ons were found that offer a similar JDBC driver
JDBC driver not available for com.ibm.as400.access.AS400JDBCDriver"
Thanks in advance.
DB2/400 uses the JTOpen driver from memory? The jar was large (4.3Mb) and was is not shipped with Roo. If you build Roo from Git, do a mvn clean install in the wrapping directory first and then you can copy the jar from your mvn repo to the Roo bundle directrory for M3, or just use the Git code after doing the same mvn clean install from Roo root directory.
That's right, it does use JTOpen. I can understand that the jar is quite large, in probably 99.9% of any of my projects, it's always the biggest jar because IBM has packed in so much for the System i/AS400. It has grown in size even since I started using earlier versions.
So given that the jar is too large to ship with Roo, what does that mean for the future of DBRE support for DB2400? Could the add-on be setup to scan the application dependencies for the available driver? That would be beneficial for DB2400 as well as for any other datasource that might use a proprietary JDBC driver that is not available open source. What do you think?
It simply means Roo won't ship it, as we don't for other jars like Oracle and DB2, though these databases are available for DBRE. To test it, build the wrapping directory, then all of Roo.
I built Roo M4 from source. First I tried merely copying the org.springframework.roo.wrapping.jtopen-6.7.0.0001.jar file to the M3 bundle directory and restarting the roo shell followed by the "database reverse engineer" command. That resulted in an IllegalArgumentException. So next I tried just doing the DBRE from Roo M4 that I just built and I got the same exception and the same message as before re "JDBC driver not available for com.ibm.as400.access.AS400JDBCDriver"
test2 roo> database reverse engineer --schema patrick --package test2
No Spring Roo add-ons were found that offer a similar JDBC driver
JDBC driver not available for 'com.ibm.as400.access.AS400JDBCDriver'
java.lang.IllegalArgumentException: JDBC driver not available for 'com.ibm.as400.access.AS400JDBCDriver'
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:285)
at org.springframework.roo.addon.dbre.DbreModelServic eImpl.getDatabase(DbreModelServiceImpl.java:184)
at org.springframework.roo.addon.dbre.DbreModelServic eImpl.refreshDatabase(DbreModelServiceImpl.java:13 7)
at org.springframework.roo.addon.dbre.DbreOperationsI mpl.reverseEngineerDatabase(DbreOperationsImpl.jav a:79)
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(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at org.springframework.roo.support.util.ReflectionUti ls.invokeMethod(ReflectionUtils.java:191)
at org.springframework.roo.process.manager.ProcessMan agerHostedExecutionStrategy$1.callback(ProcessMana gerHostedExecutionStrategy.java:49)
at org.springframework.roo.process.manager.internal.D efaultProcessManager.doTransactionally(DefaultProc essManager.java:177)
at org.springframework.roo.process.manager.internal.D efaultProcessManager.execute(DefaultProcessManager .java:140)
at org.springframework.roo.process.manager.ProcessMan agerHostedExecutionStrategy.execute(ProcessManager HostedExecutionStrategy.java:47)
at org.springframework.roo.shell.AbstractShell.execut eCommand(AbstractShell.java:159)
at org.springframework.roo.shell.jline.JLineShell.pro mptLoop(JLineShell.java:324)
at org.springframework.roo.shell.jline.JLineShell.run (JLineShell.java:117)
It would appear then that there are missing dependencies. In the pom in the wrapping directory for jtopen, the Import-Package element in the build plugin needs to be modified. However, it will be a trial and error process.Perhaps the exclusion com.ibm.* is too much.
This will require more investigation
Is there anything I can do to assist you?
Perhaps you can make changes to the pom.xml in the jtopen directory underneath the wrapping directory. Previously I was excluding com.ibm.* I changed this to
However it still gives the same error. You could tweak these settings, by first removing com.ibm.sslight.* to see what errors result. The driver needs a minimum set of dependencies for it to work, and making com.ibm.* optional was too severe. Make sure your database.properties in the project has the correct connection parameters.
1) make change in pom.xml of <roo dir>/wrapping/jtopen
2) run mvn clean install in <roo dir>/wrapping/jtopen
3) run mvn clean install in <roo dir>/addon-jdbc
4) start roo with
You will see errors in the dependencies in the startup. These can then be added to the Import-Package statement. Then repeat the process until no errors occur. The example above of com.ibm.sslight.* may need to be com.ibm.sslight.foo.* for example, but you will see this in the error message when Roo starts. Let me know if you don't understand what I have said or are having trouble.
rm -rf <roo dir>/bootstrap/target/osgi; roo-dev
We're doing a release next week and I am flat out at the moment on other things, so would appreciate it.
Would you also log a bug on this in Jira?
Thanks Alan. I'm out of town this week working on a bunch of other projects, but I'll try all of this when I'm back at the end of next week. Will keep you posted. I'll also open that JIRA bug.