osmosis : Error creating map file from osm with mapwriter plugin

580 views
Skip to first unread message

yogesh10446

unread,
Jul 14, 2016, 12:31:37 PM7/14/16
to mapsforge-dev
Hi,

I have installed osmosis from the source as provided in the link http://wiki.openstreetmap.org/wiki/Osmosis/Installation#Linux

    $ cd ~/src
    $ git clone git://github.com/openstreetmap/osmosis.git
    $ cd osmosis
    $ ./gradlew assemble

and seems osmosis has been properly installed with version Osmosis Version 0.45-41-gf840f6f-SNAPSHOT

And then downloaded the mapsforge-map-writer-0.6.1.jar plugin and moved it to ~/.openstreetmap/osmosis/plugins/

and then i ran the conversion

$ ./bin/osmosis/package/bin/osmosis --rb file=Downloads/nepal-latest.osm.pbf --mapfile-writer file=tests/nepal.map


everything seems to be going fine, until this error showed up.

SEVERE: Thread for task 1-rb failed
java.lang.AbstractMethodError: org.mapsforge.map.writer.osmosis.MapFileWriterTask.close()V
at crosby.binary.osmosis.OsmosisReader.run(OsmosisReader.java:50)
at java.lang.Thread.run(Thread.java:745)

Jul 14, 2016 9:48:12 PM org.openstreetmap.osmosis.core.Osmosis main
SEVERE: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks failed.
at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForCompletion(Pipeline.java:146)
at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:92)
at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)
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.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)

Am I doing this right or am i missing something. For past few days i have been stuck at this point.
Can someone please put some light to this issue.

Also in some posts I saw that they were suggesting to use osmosis version 0.40 with mapwriter 0.3.0( checked the post date and were years old)
which made me think if this is due to the compatibilityissue of the osmosis version and the mapwriter.





Emux

unread,
Jul 14, 2016, 12:38:35 PM7/14/16
to mapsfo...@googlegroups.com
No need to build Osmosis, it provides ready versions to use.

Just download the latest stable release zip, from here:
http://wiki.openstreetmap.org/wiki/Osmosis#Latest_stable_version

Just tested and works fine.

--
Emux

yogesh10446

unread,
Jul 15, 2016, 1:44:35 AM7/15/16
to mapsforge-dev
Thanks for your feedback Emux,

I downloaded the latest-stable release for osmosis and was able to run the command.

    $ osmosis-latest/bin/osmosis --rb file=Downloads/nepal-latest.osm.pbf --mapfile-writer file=tests/nepal.map type=hd

But then I came upon this error

Jul 15, 2016 11:21:06 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask complete
INFO: start writing file...
Jul 15, 2016 11:21:08 AM org.openstreetmap.osmosis.core.pipeline.common.ActiveTaskManager waitForCompletion
SEVERE: Thread for task 1-rb failed
java.lang.NoClassDefFoundError: com/google/common/cache/LocalCache$Segment
    at com.google.common.cache.LocalCache.newSegmentArray(LocalCache.java:1965)
    at com.google.common.cache.LocalCache.<init>(LocalCache.java:281)
    at com.google.common.cache.LocalCache$LocalLoadingCache.<init>(LocalCache.java:4817)
    at com.google.common.cache.CacheBuilder.build(CacheBuilder.java:789)
    at org.mapsforge.map.writer.MapFileWriter.writeFile(MapFileWriter.java:347)
    at org.mapsforge.map.writer.osmosis.MapFileWriterTask.complete(MapFileWriterTask.java:102)
    at crosby.binary.osmosis.OsmosisBinaryParser.complete(OsmosisBinaryParser.java:35)
    at org.openstreetmap.osmosis.osmbinary.file.BlockInputStream.process(BlockInputStream.java:37)
    at crosby.binary.osmosis.OsmosisReader.run(OsmosisReader.java:45)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.google.common.cache.LocalCache$Segment
    at org.java.plugin.standard.StandardPluginClassLoader.loadClass(StandardPluginClassLoader.java:330)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 10 more


Any idea what this is?

Emux

unread,
Jul 15, 2016, 2:09:54 AM7/15/16
to mapsfo...@googlegroups.com
The missing class is part of the Guava library, a dependency of map-writer.

Try using the mapsforge-map-writer-0.6.1-jar-with-dependencies.jar provided in our downloads page.

(or else you'll need to put all dependencies jars yourself)

--
Emux

yogesh10446

unread,
Jul 15, 2016, 5:07:31 AM7/15/16
to mapsforge-dev

 That worked perfectly!

 Thanks a lot. :)
 
 But just out of curiosity, does osmosis not know of the dependencies if the file name of the map-writer is changed because,
 I had the same jar file and tried with mapsforge-map-writer-0.6.1-jar-with-dependencies.jar,  which turned out to work fine
 but when i changed the name to only mapsforge-map-writer-0.6.1.jar, it gave me the same NoClassDefFound exception.


Emux

unread,
Jul 15, 2016, 5:15:31 AM7/15/16
to mapsfo...@googlegroups.com
Those two map-writer jars are different:

- The plain one has only the Mapsforge code inside without any dependencies. So during run if they're missing the program (Osmosis) will fail.

- The jar-with-dependencies has also the dependencies for user convenience.

--
Emux

yogesh10446

unread,
Jul 15, 2016, 5:39:45 AM7/15/16
to mapsforge-dev
No I mean, I am using the same map-writer jar,
but changed their file names to mapsforge-map-writer-0.6.1.jar and mapsforge-map-writer-0.6.1-jar-with-dependencies.jar


Emux

unread,
Jul 15, 2016, 5:43:16 AM7/15/16
to mapsfo...@googlegroups.com
A jar rename does not remove or add its classes.

Are you sure Osmosis classpath has only the jar you mean to test?

--
Emux

yogesh10446

unread,
Jul 15, 2016, 5:58:55 AM7/15/16
to mapsforge-dev

Yes, i have only one jar.

Previously I was working with the jar (that I renamed as i thought the filename was too long), which gave me that dependency error.

Then I again downloaded the jar, and replaced the old one with the new jar (Without changing the file name), which ran successfully.

I guess the previous jar was corrupted or such and replacing with the new one made it better.
Anyways, the map-writer is working good now.





Reply all
Reply to author
Forward
0 new messages