Hello,
So i had to convert my production DB from MariaDB to Derby. I went through
the steps at http://db.apache.org/derby/integrate/db_ddlutils.html
<http://db.apache.org/derby/integrate/db_ddlutils.html> but i had a
problem when i run the export Ant task.
The following text includes the environment variables i set & the failure
message from Ant alongside with the build.xml file. The database URL is
correct & works fine in the JVM.
*
The environment variables :
*
afr0ck@afr0ck:~/Desktop/ESTORE/ddlutils$ echo $CLASSPATH
/home/afr0ck/Desktop/ESTORE/sqlite-jdbc-3.21.0.jar:/home/afr0ck/Desktop/ESTORE/db-derby-10.14.1.0-lib/lib/derby.jar:/home/afr0ck/Desktop/ESTORE/db-derby-10.14.1.0-lib/lib/derbytools.jar:/home/afr0ck/Desktop/ESTORE/mariadb-java-client-2.2.1.jar
*
build.xml :
*
<?xml version="1.0" encoding="UTF-8"?>
<project name="MigrateToDerby" basedir=".">
<path id="classpath">
<fileset dir="./lib">
<include name="**/*.jar" />
</fileset>
</path>
<target name="export-source-db" description="Dumps db
structure and data">
<taskdef name="databaseToDdl"
classname="org.apache.ddlutils.task.DatabaseToDdlTask">
<classpath refid="classpath" />
</taskdef>
<databaseToDdl modelName="MigrateTest">
<database url="jdbc:mariadb://localhost:3306/estore"
driverClassName="org.mariadb.jdbc.Driver"
username="root" password="afr0ck" />
<writeSchemaToFile outputFile="db-schema.xml" />
<writeDataToFile outputFile="data.xml" />
</databaseToDdl>
</target>
</project>
*
Ant task execution :
*
afr0ck@afr0ck:~/Desktop/ESTORE/ddlutils$ ant -v export-source-db
Apache Ant(TM) version 1.10.3 compiled on March 24 2018
Trying the default build file: build.xml
Buildfile: /home/afr0ck/Desktop/ESTORE/ddlutils/build.xml
Detected Java version: 1.8 in: /home/afr0ck/jdk1.8.0_144/jre
Detected OS: Linux
parsing buildfile /home/afr0ck/Desktop/ESTORE/ddlutils/build.xml with URI =
file:/home/afr0ck/Desktop/ESTORE/ddlutils/build.xml
Project base dir set to: /home/afr0ck/Desktop/ESTORE/ddlutils
parsing buildfile
jar:file:/usr/local/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with
URI = jar:file:/usr/local/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml
from a zip file
Build sequence for target(s) `export-source-db' is [export-source-db]
Complete build sequence is [export-source-db, ]
export-source-db:
BUILD FAILED/home/afr0ck/Desktop/ESTORE/ddlutils/build.xml:12: Could not
read the schema from the specified database: Database type null is not
supported.
at
org.apache.ddlutils.task.PlatformConfiguration.getPlatform(PlatformConfiguration.java:226)
at
org.apache.ddlutils.task.DatabaseTaskBase.getPlatform(DatabaseTaskBase.java:288)
at
org.apache.ddlutils.task.DatabaseToDdlTask.readModel(DatabaseToDdlTask.java:265)
at
org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.java:381)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:448)
at org.apache.tools.ant.Target.performTasks(Target.java:469)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1370)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.Main.runBuild(Main.java:849)
at org.apache.tools.ant.Main.startAnt(Main.java:228)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:283)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
Caused by: java.lang.NullPointerException
at
org.apache.ddlutils.PlatformFactory.createNewPlatformInstance(PlatformFactory.java:83)
at
org.apache.ddlutils.task.PlatformConfiguration.getPlatform(PlatformConfiguration.java:222)
... 20 more
Total time: 0 seconds
What could be wrong with the above configuration ?
--
Sent from:
http://apache-database.10148.n7.nabble.com/Apache-Derby-Users-f95095.html