You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-user@db.apache.org by thillerson <to...@effectiveui.com> on 2006/08/09 01:41:13 UTC
java.net.MalformedURLException while writing Schema
Hello,
I just ran accross dbutils today and I'm glad to find something at least
approacing rails migrations (not nearly, but getting close, I guess) in the
java world where I need to spend my days.
I have a very simple problem - I get a java.net.MalformedURLException when
trying to dump the schema from an existing mysql db. The data will get
written, but the schema will not.
Here's my build file's relevant parts:
<target name="db-structure-dump" description="Dumps the database structure"
depends="init">
<databaseToDdl>
<database url="${datasource.url}"
driverClassName="${datasource.driverClassName}"
username="${datasource.username}" password="${datasource.password}" />
<!--<writeSchemaSqlToFile alterDatabase="false"
outputFile="database.ddl"/>-->
<!--<writeDtdToFile outputFile="schema.dtd"/>-->
<writeSchemaToFile outputFile="${build.dir}/schema.xml"/>
</databaseToDdl>
</target>
<target name="db-dump" description="Dumps the database structure"
depends="init">
<databaseToDdl>
<database url="${datasource.url}"
driverClassName="${datasource.driverClassName}"
username="${datasource.username}" password="${datasource.password}" />
<writeDataToFile outputFile="${build.dir}/data.xml"/>
</databaseToDdl>
</target>
And here's the output of an `ant -v db-structure-dump`:
C:\work\mcc\trunk\mcc-data>ant -v db-structure-dump
Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: build.xml
Detected Java version: 1.5 in: C:\java\jre
Detected OS: Windows XP
parsing buildfile C:\work\mcc\trunk\mcc-data\build.xml with URI =
file:///C:/wor
k/mcc/trunk/mcc-data/build.xml
Project base dir set to: C:\work\mcc\trunk\mcc-data
[property] Loading C:\work\mcc\trunk\mcc-data\jdbc.properties.mysql
Build sequence for target(s) `db-structure-dump' is [init,
db-structure-dump]
Complete build sequence is [init, db-structure-dump, db-load, db-dump, ]
init:
[echo] Using Database at jdbc:mysql://127.0.0.1/mcc
db-structure-dump:
BUILD FAILED
C:\work\mcc\trunk\mcc-data\build.xml:40: Failed to write to output file
C:\work\
mcc\trunk\mcc-data\target\schema.xml
at
org.apache.ddlutils.task.WriteSchemaToFileCommand.execute(WriteSchema
ToFileCommand.java:82)
at
org.apache.ddlutils.task.DatabaseTaskBase.executeCommands(DatabaseTas
kBase.java:240)
at
org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.ja
va:264)
at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: org.apache.ddlutils.DdlUtilsException:
java.net.MalformedURLException
at org.apache.ddlutils.io.DatabaseIO.write(DatabaseIO.java:299)
at
org.apache.ddlutils.task.WriteSchemaToFileCommand.execute(WriteSchema
ToFileCommand.java:76)
... 14 more
Caused by: java.net.MalformedURLException
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at
org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown So
urce)
at
org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1647)
at
org.apache.commons.betwixt.XMLIntrospector.loadMultiMapping(XMLIntros
pector.java:657)
at
org.apache.commons.betwixt.XMLIntrospector.register(XMLIntrospector.j
ava:627)
at org.apache.ddlutils.io.DatabaseIO.getWriter(DatabaseIO.java:135)
at org.apache.ddlutils.io.DatabaseIO.write(DatabaseIO.java:295)
... 15 more
--- Nested Exception ---
org.apache.ddlutils.DdlUtilsException: java.net.MalformedURLException
at org.apache.ddlutils.io.DatabaseIO.write(DatabaseIO.java:299)
at
org.apache.ddlutils.task.WriteSchemaToFileCommand.execute(WriteSchema
ToFileCommand.java:76)
at
org.apache.ddlutils.task.DatabaseTaskBase.executeCommands(DatabaseTas
kBase.java:240)
at
org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.ja
va:264)
at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: java.net.MalformedURLException
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at
org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown So
urce)
at
org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1647)
at
org.apache.commons.betwixt.XMLIntrospector.loadMultiMapping(XMLIntros
pector.java:657)
at
org.apache.commons.betwixt.XMLIntrospector.register(XMLIntrospector.j
ava:627)
at org.apache.ddlutils.io.DatabaseIO.getWriter(DatabaseIO.java:135)
at org.apache.ddlutils.io.DatabaseIO.write(DatabaseIO.java:295)
... 15 more
Total time: 2 seconds
The problem is not that I didn't create the build.dir, and it also happens
if I put the output file in the root of the project. As I said, the
writeSchemaSqlToFile and writeDataToFile tasks work fine.
Any ideas what's going on?
--
View this message in context: http://www.nabble.com/java.net.MalformedURLException-while-writing-Schema-tf2075920.html#a5717307
Sent from the Apache DdlUtils - User forum at Nabble.com.
Re: java.net.MalformedURLException while writing Schema
Posted by Thomas Dudziak <to...@gmail.com>.
On 8/9/06, thillerson <to...@effectiveui.com> wrote:
> However: I built Ddlutils using maven. As a side note, the pom was missing
> commons-digester and commons-beanutils, so I had to add the versions used in
> the svn repo to the pom.
>
> This morning on a lark I rebuilt the jar using ant instead of maven, and
> that artifact was a few K different. I figured that was because of the maven
> metatdata, but there may be other differences too. I'll attach both jars.
>
> The upshot is that the ant built artifact works and the maven built artifact
> doesn't. If you'd like to look into the issue further I can provide you with
> anything in my environment to help you track the problem down.
Yeah, well, I don't use Maven, and Martin takes care of the POM
(though I think it is not suited for building). Note also that there
is an open issue for the POM:
http://issues.apache.org/jira/browse/DDLUTILS-110
Tom
Re: java.net.MalformedURLException while writing Schema
Posted by thillerson <to...@effectiveui.com>.
So, to let you know where I am:
I had copied all the jars from the working copy's lib directory, so all the
distributed dependencies are the ones being used.
However: I built Ddlutils using maven. As a side note, the pom was missing
commons-digester and commons-beanutils, so I had to add the versions used in
the svn repo to the pom.
This morning on a lark I rebuilt the jar using ant instead of maven, and
that artifact was a few K different. I figured that was because of the maven
metatdata, but there may be other differences too. I'll attach both jars.
The upshot is that the ant built artifact works and the maven built artifact
doesn't. If you'd like to look into the issue further I can provide you with
anything in my environment to help you track the problem down.
Tony
Maven built jar
http://www.nabble.com/user-files/233/ddlutils-1.0-SNAPSHOT.jar
ddlutils-1.0-SNAPSHOT.jar
Ant built jar
http://www.nabble.com/user-files/234/DdlUtils-1.0-dev.jar
DdlUtils-1.0-dev.jar
--
View this message in context: http://www.nabble.com/java.net.MalformedURLException-while-writing-Schema-tf2075920.html#a5729504
Sent from the Apache DdlUtils - User forum at Nabble.com.
Re: java.net.MalformedURLException while writing Schema
Posted by Thomas Dudziak <to...@gmail.com>.
On 8/8/06, thillerson <to...@effectiveui.com> wrote:
> I just ran accross dbutils today and I'm glad to find something at least
> approacing rails migrations (not nearly, but getting close, I guess) in the
> java world where I need to spend my days.
>
> I have a very simple problem - I get a java.net.MalformedURLException when
> trying to dump the schema from an existing mysql db. The data will get
> written, but the schema will not.
<snip>
> Caused by: java.net.MalformedURLException
> at java.net.URL.<init>(Unknown Source)
> at java.net.URL.<init>(Unknown Source)
> at java.net.URL.<init>(Unknown Source)
> at
> org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown So
> urce)
> at
> org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown
> Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.apache.commons.digester.Digester.parse(Digester.java:1647)
> at
> org.apache.commons.betwixt.XMLIntrospector.loadMultiMapping(XMLIntros
> pector.java:657)
> at
It appears that there is some problem with betwixt. Please make sure
that the libraries that come with DdlUtils are used by the task, not
perhaps some older versions. More precisely, ensure that betwixt
0.8-dev and digester 1.7 (I think) are used.
Tom