java.lang.nullpointerexception in program Osmosis

293 views
Skip to first unread message

hans

unread,
Jan 30, 2011, 1:49:05 AM1/30/11
to mapsforge-dev
Hello,

thanks for your open source project.

From a file Wien.osm I want to create a file Wien.map with Osmosis. I
installed Osmosis in Windows 7 by following the User Documentation:
"Mapsforge Mapfile-Writer Osmosis-Plugin". My parameters are:

D:/android-software/osmosis/SVN/package/bin/osmosis.bat --rx file=D:/
android-software/Landkarten/Wien.osm --mapfile-writer file=D:/android-
software/Landkarten/Wien1.map bbox=48.20,16.37,48.21,16.38 debug=true

But then I get a java.lang.nullpointerexception in Osmosis right after
the start:
Info: Osmosis Version SNAPSHOT-r25183
org openstreetmap.osmosis.core.Osmosis.main
SCHWERWIEGND: Execution aborted
java.lang.nullpointerexception
at.org.java.plugin.standard.StandardPluginManager.publishPlugins(StandardPlaginManager.java:
181)

Maybe somebody can give me a hint? Kindly
hans

hans

unread,
Jan 30, 2011, 9:03:41 AM1/30/11
to mapsforge-dev
It should be a problem with the plugins.

1) After a new installation of Osmosis, my $USER_HOME is "C:\Users
\xxx". Therefore I created "C:\Users\xxx\.openstreetmap\osmosis
\plugins" and copied mapsforge-mapfile-writer-0.2.0.jar into it.

2) my $OSMOSIS_HOME is "C:\Users\xxx\osmosis". After SVN installation
into this folder I got many subdirectories C:\Users\xxx\osmosis\apidb,
C:\Users\xxx\osmosis\areafilter,...but no C:\Users\xxx\osmosis\lib
\default subdirectory, which should exist. So I cannot copy
jts-1.11.jar and trove-3.0.0rc1.jar to $OSMOSIS_HOME/lib/default as
described.
Hello,

In the following cases I get the "error with the StandardPluginManager
(181, NullPointerException"):

a) copied jts-1.11.jar and trove-3.0.0rc1.jar into C:\Users\xxx
\.openstreetmap\osmosis\plugins
b) copied jts-1.11.jar and trove-3.0.0rc1.jar into C:\Users\xxx\AppData
\Roaming\Openstreetmap\Osmosis\Plugins

Here I get "cannot load JPF-plugin" message:
c) copied jts-1.11.jar and trove-3.0.0rc1.jar into C:\Users\xxx
\osmosis
d) copied jts-1.11.jar and trove-3.0.0rc1.jar into C:\Users\xxx\osmosis
\lib\default ( I created this folders )
e) copied jts-1.11.jar and trove-3.0.0rc1.jar into C:\Users\xxx\osmosis
\package\lib\default
f) copied jts-1.11.jar and trove-3.0.0rc1.jar into C:\Users\xxx\AppData
\Local\Openstreetmap\Osmosis\Plugins

I use Windows7 64 bit and Java 1.6.0_23 64 bit.

kindly hans

hans

unread,
Jan 30, 2011, 6:39:52 PM1/30/11
to mapsforge-dev
Downloaded the pre-built Osmosis 0.38 instead of SVN version. Now I
got the folder \lib\default. I copied jts-1.11.jar and
trove-3.0.0rc1.jar into it, but I still get the same error.

hans

unread,
Jan 30, 2011, 6:59:27 PM1/30/11
to mapsforge-dev

Now it's working! I just had to refresh the command shell. It's just
exactly like the description says:
mapsforge-mapfile-writer-0.2.0.jar in the folder "C:\Users\xxx
\.openstreetmap\osmosis
\plugins" and jts-1.11.jar and trove-3.0.0rc1.jar in *\lib\default .

hans im Glück

GerhardS

unread,
Feb 1, 2011, 3:20:53 AM2/1/11
to mapsforge-dev
Hello Hans,

do you need a xml file to define the plugin? Like plugin.xml as
described in http://wiki.openstreetmap.org/wiki/Osmosis/WritingPlugins
?

I am getting the following error running osmosis on windows Vista:

C:\osmosis-latest\osmosis-0.38>bin\osmosis --rb file=map1.osm --
mapfile-writer file=map1.map
01.02.2011 08:59:10 org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.38
01.02.2011 08:59:10 org.openstreetmap.osmosis.core.Osmosis main
SCHWERWIEGEND: Execution aborted.
java.lang.AbstractMethodError:
javax.xml.parsers.SAXParser.getXMLReader()Lorg/xml/sax/XMLReader;
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at
org.java.plugin.registry.xml.ManifestParser.parseManifest(ManifestParser.java:
118)
at
org.java.plugin.registry.xml.PluginRegistryImpl.register(PluginRegistryImpl.java:
187)
at
org.openstreetmap.osmosis.core.TaskRegistrar.registerCorePlugin(TaskRegistrar.java:
209)
at
org.openstreetmap.osmosis.core.TaskRegistrar.loadJPFPlugins(TaskRegistrar.java:
159)
at
org.openstreetmap.osmosis.core.TaskRegistrar.initialize(TaskRegistrar.java:
88)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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:31)

thanks for any hint
Gerhard

Jürgen Broß

unread,
Feb 1, 2011, 4:05:48 AM2/1/11
to mapsfo...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Gerhard,

no, you do not need to define a plugin.xml. It is already included in
the mapfile-writer plugin. Unless you want to write your own plugin, you
do not need to care.

However, it seems that you are trying to read a XML-file (map1.osm) with
the osmosis protocol buffer reader (option --rb). Please use the option
- --rx to read a XML-file and make sure that it includes a bounding box
definition (otherwise use the bbox option of the mapfile-writer plugin).
Please have a look at
http://wiki.openstreetmap.org/wiki/Osmosis/Detailed_Usage for the
detailes usage of osmosis.

Best regards,
J�rgen


- --

J�rgen Bro�
Institute of Computer Science
Freie Universit�t Berlin
Takustr. 9
14195 Berlin, Germany
Phone: +49 30 838-75108
email: juerge...@fu-berlin.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNR8zrAAoJELhzyv13y+u9o5oIAKpFJ32cBgX6WDKSo/c/iNSV
Re2q4pupWT/bnzlJyoivOheGjoEqYvVTLrGXIzjuyszPEiJ5A9BwBaRxPJRIwDau
c5nhIQfI1kSA3sJ8yYtCcxbyL9hGchHVupmlhZZ1uGFOB+3+pQ2XJSCUtM07UfPV
mNIcJXT7ybrPBParh/8lNUieIMX86rmMDpbu351jNMrPrF5Svg0Zm8sdVXpk9Wn5
h/zu6fj9JMdDyQj//NsgjzXE/Hawr5NXA3JGXufWj1BrBnTk/EiFO/mkRWDffsv7
NCRCLO65o5l2EveB+7E86G7LK3F0SB3+fxi1pP9GQbWDvunoEpi72UrIpiO9/W0=
=mHPO
-----END PGP SIGNATURE-----

GerhardS

unread,
Feb 1, 2011, 4:37:16 AM2/1/11
to mapsforge-dev
Thank you Jürgen,

yes map1.osm is an xml file, containing this root node: <osm
version="0.6" generator="CGImap 0.0.2">. I exported it from
openstreetmaps web page (as open streetmap xml file). But still with --
rx I get the same error with the same callstack displayed. Maybe this
kind of xml file is not what osmosis expects. Even "bin\osmosis --rx
file=map1.osm --wn" returns that same error, so it doesn't concern the
plugin.
So were do I get valid input files for osmosis from? The nicest
solution would be to specify only a bounding box and get the data
directly from the open streetmap web server. Where do I get *.osm
files from?

Thank you
Gerhard

On 1 Feb., 10:05, Jürgen Broß <juergen.br...@fu-berlin.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello Gerhard,
>
> no, you do not need to define a plugin.xml. It is already included in
> the mapfile-writer plugin. Unless you want to write your own plugin, you
> do not need to care.
>
> However, it seems that you are trying to read a XML-file (map1.osm) with
> the osmosis protocol buffer reader (option --rb). Please use the option
> - --rx to read a XML-file and make sure that it includes a bounding box
> definition (otherwise use the bbox option of the mapfile-writer plugin).
> Please have a look athttp://wiki.openstreetmap.org/wiki/Osmosis/Detailed_Usagefor the
> detailes usage of osmosis.
>
> Best regards,
> J rgen
>
> On 02/01/2011 09:20 AM, GerhardS wrote:
>
>
>
>
>
> > Hello Hans,
>
> > do you need a xml file to define the plugin? Like plugin.xml as
> > described inhttp://wiki.openstreetmap.org/wiki/Osmosis/WritingPlugins
> > ?
>
> > I am getting the following error running osmosis on windows Vista:
>
> > C:\osmosis-latest\osmosis-0.38>bin\osmosis --rb file=map1.osm --
> > mapfile-writer file=map1.map
> > 01.02.2011 08:59:10 org.openstreetmap.osmosis.core.Osmosis run
> > INFO: Osmosis Version 0.38
> > 01.02.2011 08:59:10 org.openstreetmap.osmosis.core.Osmosis main
> > SCHWERWIEGEND: Execution aborted.
> > java.lang.AbstractMethodError:
> > javax.xml.parsers.SAXParser.getXMLReader()Lorg/xml/sax/XMLReader;
> >         at javax.xml.parsers.SAXParser.parse(Unknown Source)
> >         at javax.xml.parsers.SAXParser.parse(Unknown Source)
> >         at
> > org.java.plugin.registry.xml.ManifestParser.parseManifest(ManifestParser.ja­va:
> > 118)
> >         at
> > org.java.plugin.registry.xml.PluginRegistryImpl.register(PluginRegistryImpl­.java:
> > 187)
> >         at
> > org.openstreetmap.osmosis.core.TaskRegistrar.registerCorePlugin(TaskRegistr­ar.java:
> > 209)
> >         at
> > org.openstreetmap.osmosis.core.TaskRegistrar.loadJPFPlugins(TaskRegistrar.j­ava:
> > 159)
> >         at
> > org.openstreetmap.osmosis.core.TaskRegistrar.initialize(TaskRegistrar.java:
> > 88)
> >         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(Unknown Source)
> >         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> > Source)
> >         at java.lang.reflect.Method.invoke(Unknown Source)
> >         at
> > org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.j­ava:
> > 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:31)
>
> > thanks for any hint
> > Gerhard
>
> - --
>
> J rgen Bro
> Institute of Computer Science
> Freie Universit t Berlin
> Takustr. 9
> 14195 Berlin, Germany
> Phone: +49 30 838-75108
> email: juergen.br...@fu-berlin.de
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> iQEcBAEBAgAGBQJNR8zrAAoJELhzyv13y+u9o5oIAKpFJ32cBgX6WDKSo/c/iNSV
> Re2q4pupWT/bnzlJyoivOheGjoEqYvVTLrGXIzjuyszPEiJ5A9BwBaRxPJRIwDau
> c5nhIQfI1kSA3sJ8yYtCcxbyL9hGchHVupmlhZZ1uGFOB+3+pQ2XJSCUtM07UfPV
> mNIcJXT7ybrPBParh/8lNUieIMX86rmMDpbu351jNMrPrF5Svg0Zm8sdVXpk9Wn5
> h/zu6fj9JMdDyQj//NsgjzXE/Hawr5NXA3JGXufWj1BrBnTk/EiFO/mkRWDffsv7
> NCRCLO65o5l2EveB+7E86G7LK3F0SB3+fxi1pP9GQbWDvunoEpi72UrIpiO9/W0=
> =mHPO
> -----END PGP SIGNATURE------ Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

GerhardS

unread,
Feb 1, 2011, 6:08:21 AM2/1/11
to mapsforge-dev
Don't know why, but restarting the command window made the error
disappear....

Then I was fighting the next problem: my osm file seems to have no
valid bounding box, so I was trying to specify a bounding box. You
have to specify the bounding box as "bbox=52.4,13.2,52.6,13.4", as an
argument to the mapfile-writer, not as "--bounding-box left=..."
The resulting map file is huge, 50Mbyte from an 9MByte osm file. This
is probably due to the memory mapping IO and not beeing able to
truncate the resulting file on Windows Vista.
I also tried to use "hessen.osm.pbf" as a binary file but then after a
while I got an out of memory exception. This seems to be the same
memory mapping IO problem. So I will have to wait for the next mapfile-
writer version, right?

Jürgen Broß

unread,
Feb 1, 2011, 6:30:55 AM2/1/11
to mapsfo...@googlegroups.com
Hi Gerhard,

it seems that the osmosis installation itself is somehow misconfigured.
It seems that the manifest of any plugin (which is defined in xml) is
not read properly, since a required SAX-Parser cannot be loaded.

* Which version of Java are you using? What does 'java -version' tell you?
* Which steps did you perform in installing osmosis?

The XML that is produced by the OSM website lacks a bounding box
definition, so you need to add it via the bbox option when you run the
mapfile-writer plugin.

You can get OSM-data for lots of regions from Geofabrik
(http://download.geofabrik.de/). My advice is to use the protocol-buffer
format (*.pbf) as it is more compact and faster to process.
(Be aware that also the osm.xml files you download from Geofabrik lack a
bounding box definition.)

Best regards,
Jürgen

Am 01.02.2011 10:37, schrieb GerhardS:
> Thank you Jürgen,
>
> yes map1.osm is an xml file, containing this root node: <osm
> version="0.6" generator="CGImap 0.0.2">. I exported it from
> openstreetmaps web page (as open streetmap xml file). But still with --
> rx I get the same error with the same callstack displayed. Maybe this
> kind of xml file is not what osmosis expects. Even "bin\osmosis --rx
> file=map1.osm --wn" returns that same error, so it doesn't concern the
> plugin.
> So were do I get valid input files for osmosis from? The nicest
> solution would be to specify only a bounding box and get the data
> directly from the open streetmap web server. Where do I get *.osm
> files from?
>
> Thank you
> Gerhard
>
> On 1 Feb., 10:05, Jürgen Broß <juergen.br...@fu-berlin.de> wrote:
> Hello Gerhard,
>
> no, you do not need to define a plugin.xml. It is already included in
> the mapfile-writer plugin. Unless you want to write your own plugin, you
> do not need to care.
>
> However, it seems that you are trying to read a XML-file (map1.osm) with
> the osmosis protocol buffer reader (option --rb). Please use the option

- Zitierten Text anzeigen -

--


Jürgen Broß
Institute of Computer Science
Databases and Information Systems
Freie Universität Berlin
Takustr. 9
D-14195 Berlin, Germany
phone: +49 30 838-75108
email: juerge...@fu-berlin.de

signature.asc

Peter Pan

unread,
Feb 1, 2011, 6:38:40 AM2/1/11
to mapsforge-dev
Hello Gerhard!

I can give you you compiled mapfile-writer which works with
'hessen.osm.pbf', when you use the parameter 'type=hd'. Interested?

But you must wait for today evening.

Peter

Jürgen Broß

unread,
Feb 1, 2011, 6:41:17 AM2/1/11
to mapsfo...@googlegroups.com
Ok,

missed your last mail. So forget the first part of my last mail...

Your guess is right: The huge size of the map file is due to the
memory-mapped I/O problem under Windows (see fixed issue 41). The new
version of the writer will work properly under Windows. You will also
have an option (type=hd) that allows you to use the hard disk (instead
of main memory) as temporary storage device during map creation. So you
won't exhibit the OutofMemoryException any more. As a workaround you can
adjust the available memory by setting 'JAVACMD_OPTIONS="-Xmx1500m' in
'bin/osmosis' script. Replace '1500m' with a reasonable amount of memory.

You can also checkout the current version from our public SVN. This will
work nicely.

The next release which will include the new mapfile-writer version will
be published in a few days. So stay tuned. We will announce the release
on this mailing list.

Best regards,

Jürgen

signature.asc

GerhardS

unread,
Feb 1, 2011, 7:12:21 AM2/1/11
to mapsforge-dev
Thanks alot Jürgen for your information and for this great opensource
project...
I will wait for the next release.

Gerhard
> email: juergen.br...@fu-berlin.de
>
>  signature.asc
> < 1 KBAnzeigenHerunterladen- Zitierten Text ausblenden -
Reply all
Reply to author
Forward
0 new messages