[OSM-dev] Osmosis error reading osm file and writing to mysql

Maarten Deen mdeen at xs4all.nl
Sat Dec 6 20:56:34 GMT 2008


I am starting with osmosis, and the first thing I try comes back with java errors.

I took the latest osmosis (0.29), running on Ubuntu 8.04 with java 6.

I believe I've got the database set up right, database name is osm, username is 
osm, no password. I've ran the osm_schema_latest.sql from Brett.

Mysql works:

$ mysql -D osm -u osm
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 67
Server version: 5.0.51a-3ubuntu5 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select * from current_nodes;
Empty set (0.00 sec)

mysql>

But doing

$ osmosis --read-xml file="bank.osm" --write-mysql

results in this string of error. I get the same when I specify database and 
user, instead of letting osmosis use the default.
What am I doing wrong?

Dec 6, 2008 9:51:17 PM com.bretth.osmosis.core.Osmosis main
INFO: Osmosis Version 0.29
Dec 6, 2008 9:51:17 PM com.bretth.osmosis.core.Osmosis main
INFO: Preparing pipeline.
Dec 6, 2008 9:51:17 PM com.bretth.osmosis.core.Osmosis main
INFO: Launching pipeline execution.
Dec 6, 2008 9:51:17 PM com.bretth.osmosis.core.Osmosis main
INFO: Pipeline executing, waiting for completion.
Dec 6, 2008 9:51:18 PM com.bretth.osmosis.core.pipeline.common.ActiveTaskManager 
waitForCompletion
SEVERE: Thread for task 1-read-xml failed
com.bretth.osmosis.core.OsmosisRuntimeException: Unable to establish a database 
connection.
	at 
com.bretth.osmosis.core.mysql.common.DatabaseContext.getConnection(DatabaseContext.java:92)
	at 
com.bretth.osmosis.core.mysql.common.DatabaseContext.executeStreamingQuery(DatabaseContext.java:198)
	at 
com.bretth.osmosis.core.mysql.common.SchemaVersionValidator.validateDBVersion(SchemaVersionValidator.java:63)
	at 
com.bretth.osmosis.core.mysql.common.SchemaVersionValidator.validateVersion(SchemaVersionValidator.java:45)
	at com.bretth.osmosis.core.mysql.v0_5.MysqlWriter.initialize(MysqlWriter.java:316)
	at com.bretth.osmosis.core.mysql.v0_5.MysqlWriter.process(MysqlWriter.java:1004)
	at 
com.bretth.osmosis.core.xml.v0_5.impl.NodeElementProcessor.end(NodeElementProcessor.java:99)
	at com.bretth.osmosis.core.xml.v0_5.impl.OsmHandler.endElement(OsmHandler.java:109)
	at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
	at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
	at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
	at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
	at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
	at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
	at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
	at 
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
	at com.bretth.osmosis.core.xml.v0_5.XmlReader.run(XmlReader.java:109)
	at java.lang.Thread.run(Thread.java:619)
Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure 
due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.ConnectException
MESSAGE: Connection refused

STACKTRACE:

java.net.ConnectException: Connection refused
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
	at java.net.Socket.connect(Socket.java:519)
	at java.net.Socket.connect(Socket.java:469)
	at java.net.Socket.<init>(Socket.java:366)
	at java.net.Socket.<init>(Socket.java:209)
	at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
	at com.mysql.jdbc.Connection.createNewIO(Connection.java:2744)
	at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
	at java.sql.DriverManager.getConnection(DriverManager.java:582)
	at java.sql.DriverManager.getConnection(DriverManager.java:207)
	at 
com.bretth.osmosis.core.mysql.common.DatabaseContext.getConnection(DatabaseContext.java:81)
	at 
com.bretth.osmosis.core.mysql.common.DatabaseContext.executeStreamingQuery(DatabaseContext.java:198)
	at 
com.bretth.osmosis.core.mysql.common.SchemaVersionValidator.validateDBVersion(SchemaVersionValidator.java:63)
	at 
com.bretth.osmosis.core.mysql.common.SchemaVersionValidator.validateVersion(SchemaVersionValidator.java:45)
	at com.bretth.osmosis.core.mysql.v0_5.MysqlWriter.initialize(MysqlWriter.java:316)
	at com.bretth.osmosis.core.mysql.v0_5.MysqlWriter.process(MysqlWriter.java:1004)
	at 
com.bretth.osmosis.core.xml.v0_5.impl.NodeElementProcessor.end(NodeElementProcessor.java:99)
	at com.bretth.osmosis.core.xml.v0_5.impl.OsmHandler.endElement(OsmHandler.java:109)
	at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
	at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
	at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
	at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
	at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
	at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
	at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
	at 
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
	at com.bretth.osmosis.core.xml.v0_5.XmlReader.run(XmlReader.java:109)
	at java.lang.Thread.run(Thread.java:619)


** END NESTED EXCEPTION **



Last packet sent to the server was 4 ms ago.
	at com.mysql.jdbc.Connection.createNewIO(Connection.java:2820)
	at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
	at java.sql.DriverManager.getConnection(DriverManager.java:582)
	at java.sql.DriverManager.getConnection(DriverManager.java:207)
	at 
com.bretth.osmosis.core.mysql.common.DatabaseContext.getConnection(DatabaseContext.java:81)
	... 21 more
Dec 6, 2008 9:51:18 PM com.bretth.osmosis.core.Osmosis main
SEVERE: Execution aborted.
com.bretth.osmosis.core.OsmosisRuntimeException: One or more tasks failed.
	at 
com.bretth.osmosis.core.pipeline.common.Pipeline.waitForCompletion(Pipeline.java:141)
	at com.bretth.osmosis.core.Osmosis.main(Osmosis.java:55)





More information about the dev mailing list