Unable to load plugin class (org.mapsforge.map.writer.osmosis.MapFileWriterPluginLoader)

3,037 views
Skip to first unread message

Malte Müller

unread,
May 19, 2012, 6:24:30 PM5/19/12
to mapsfo...@googlegroups.com
Hi there,

I've tried to install osmosis with the MapFileWriter plugin on my MacBook, but I still can't get it work with osmosis

I've got Mac OS 10.6.8, all security updates, and the java version is
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-10M3635)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, mixed mode)

I've created a directory named ~/.openstreetmap/osmosis/plugins and copied mapsforge-mapfile-writer-0.2.4.jar into it.
I've copied the file into my current directory. (~/osmosis/)
I've copied the file into a subdirectory "plugins" from my current directory.

I have to use 0.2.4, because I'd like to convert an OSM file to a MAP file and my device doesn't understand 0.3.0...

When I try to run osmosis -plugin org.mapsforge.map.writer.osmosis.MapFileWriterPluginLoader I get this:
20.05.2012 00:00:52 org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.40.1
20.05.2012 00:00:52 org.openstreetmap.osmosis.core.Osmosis main
SCHWERWIEGEND: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to load plugin class (org.mapsforge.map.writer.osmosis.MapFileWriterPluginLoader).
    at org.openstreetmap.osmosis.core.TaskRegistrar.loadPluginClass(TaskRegistrar.java:334)
    at org.openstreetmap.osmosis.core.TaskRegistrar.loadPlugin(TaskRegistrar.java:313)
    at org.openstreetmap.osmosis.core.TaskRegistrar.initialize(TaskRegistrar.java:84)
    at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:81)
    at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: java.lang.ClassNotFoundException: org.mapsforge.map.writer.osmosis.MapFileWriterPluginLoader
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    at org.openstreetmap.osmosis.core.TaskRegistrar.loadPluginClass(TaskRegistrar.java:332)
    ... 13 more

Maybe some path variables are wrong. USER_HOME doesn't exist, so I've set it to my homedirectory with export USER_HOME={myhome}. No effect.
Maybe there are some problems with rights. So I tried to run the application as root. No effect.
The default JAVACMD points to 1.6.

Why doesn't it find the class?

shiguera

unread,
May 19, 2012, 8:01:59 PM5/19/12
to mapsfo...@googlegroups.com
This has gone for me:
1) copy 'mapsforge-map-0.3.0-jar-with-dependencies.jar' into
'osmosis/lib/default' directory
2) Create file 'osmosis-plugins.conf' into 'osmosis/config' directory
3) Add this line to the file:
org.mapsforge.map.writer.osmosis.MapFileWriterPluginLoader

Now you can execute osmosis with:

osmosis
--read-xml file=mymap.osm
--mapfile-writer file=mymap.map
bbox=40.0,-3.0,42.0,-1.0
map-start-position=41.0,-2.0
map-start-zoom=16

Salud

Santiago Higuera

Thilo Mühlberg

unread,
May 20, 2012, 5:53:39 AM5/20/12
to mapsfo...@googlegroups.com
First, copying the mapsforge-map JAR file to the osmosis directory is
useless. It contains only the class files for the rendering library
(Android stuff). Osmosis does not need them to generate map files.

Second, you should execute Osmosis with the "--mapfile-writer" (or the
"--mw" short version) parameter as described on the wiki page
(https://code.google.com/p/mapsforge/wiki/GettingStartedMapWriter).

Are you sure you don't run Osmosis as another user (e.g. root)?

Best regards,
Thilo
signature.asc

Malte Müller

unread,
May 20, 2012, 7:31:42 AM5/20/12
to mapsfo...@googlegroups.com
Hi there,

and thank you all for the replies.
I've tried to run osmosis as a normal user. After that didn't worked, I've tried to run it as root. Didn't work.
I've followed shiguera's instructions. Didn't work...

The executed commands are:

bin/osmosis -plugin org.mapsforge.map.writer.osmosis.MapFileWriterPluginLoader
bin/osmosis --rx data/schleswig-holstein.osm --mw file=data/schleswig-holstein.map

The output is:

20.05.2012 13:21:23 org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.40.1
20.05.2012 13:21:23 org.openstreetmap.osmosis.core.Osmosis main

SCHWERWIEGEND: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to load plugin class (org.mapsforge.map.writer.osmosis.MapFileWriterPluginLoader).
    at org.openstreetmap.osmosis.core.TaskRegistrar.loadPluginClass(TaskRegistrar.java:334)
    at org.openstreetmap.osmosis.core.TaskRegistrar.loadPlugin(TaskRegistrar.java:313)
    at org.openstreetmap.osmosis.core.TaskRegistrar.loadBuiltInPlugins(TaskRegistrar.java:123)
    at org.openstreetmap.osmosis.core.TaskRegistrar.initialize(TaskRegistrar.java:80)

    at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:81)
    at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: java.lang.ClassNotFoundException: org.mapsforge.map.writer.osmosis.MapFileWriterPluginLoader
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    at org.openstreetmap.osmosis.core.TaskRegistrar.loadPluginClass(TaskRegistrar.java:332)
    ... 14 more

shiguera

unread,
May 20, 2012, 1:46:38 PM5/20/12
to mapsfo...@googlegroups.com
Sorry, I was wrong with copy-paste. The correct answer was:

1) copy 'mapsforge-map-writer-0.3.0-jar-with-dependencies.jar' into
'osmosis/lib/default' directory
2) Create file 'osmosis-plugins.conf' into 'osmosis/config' directory
3) Add this line to the file:
org.mapsforge.map.writer.osmosis.MapFileWriterPluginLoader
Now you can execute osmosis with:

osmosis
--read-xml file=mymap.osm
--mapfile-writer file=mymap.map
bbox=40.0,-3.0,42.0,-1.0
map-start-position=41.0,-2.0
map-start-zoom=16

regards

Santiago

Malte Müller

unread,
May 21, 2012, 3:43:09 PM5/21/12
to mapsfo...@googlegroups.com
Hi Santiago,

thanks for your reply. That works. (I had to remove the .openstreetmap and .osmosis folders from my homedirectory, too)
But does this plugin generate 0.2.4 files? I need 0.2.4 files, because c:geo doesn't understand 0.3.0. There'll be a blank screen. My found sources are not up-to-date (feb. 2012).

Greetings.

Mohammad Sohaib

unread,
Nov 6, 2013, 2:08:24 AM11/6/13
to mapsfo...@googlegroups.com
How do you "create a file" on Windows 8? And moreover how do you edit the file and/or add text into it?
Regards.
Message has been deleted

Jose Mari Lumanlan

unread,
Dec 12, 2013, 3:59:05 AM12/12/13
to mapsfo...@googlegroups.com
Thanks mate!!! working on linux zorin os7


Reply all
Reply to author
Forward
0 new messages