Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading PBF based maps depends on old Protobuf library #3083

Open
jurmous opened this issue Nov 29, 2024 · 5 comments · May be fixed by #3089
Open

Reading PBF based maps depends on old Protobuf library #3083

jurmous opened this issue Nov 29, 2024 · 5 comments · May be fixed by #3089

Comments

@jurmous
Copy link

jurmous commented Nov 29, 2024

Describe the bug

Osmosis dependency used by Graphhopper depends on protobuf-java version 3.25.5 max.

My project depends on protobuf-java: 4.28.2 and overwrites dependency version of the one defined by osmosis.

Project fails because makeExtensionsImmutable method is not present anymore in GeneratedMessage in any version of ProtoBuf higher than 3.25.5.

To Reproduce

I have a higher protobuf-java dependency in my project.

I read PBF formatted OSM maps from
http://download.geofabrik.de/europe/netherlands-latest.osm.pbf

I import it with GraphHopper.

It fails with java.lang.NoSuchMethodError for makeExtensionsImmutable.

Caused by: java.lang.RuntimeException: Unable to read PBF file.
	at com.graphhopper.reader.osm.pbf.PbfReader.close(PbfReader.java:66)
	at com.graphhopper.reader.osm.OSMInputFile.close(OSMInputFile.java:241)
	at com.graphhopper.reader.osm.WaySegmentParser.readOSM(WaySegmentParser.java:402)
	... 14 more
Caused by: java.lang.NoSuchMethodError: 'void org.openstreetmap.osmosis.osmbinary.Fileformat$BlobHeader.makeExtensionsImmutable()'
	at org.openstreetmap.osmosis.osmbinary.Fileformat$BlobHeader.<init>(Fileformat.java:1235)
	at org.openstreetmap.osmosis.osmbinary.Fileformat$BlobHeader.<init>(Fileformat.java:1158)
	at org.openstreetmap.osmosis.osmbinary.Fileformat$BlobHeader$1.parsePartialFrom(Fileformat.java:1914)
	at org.openstreetmap.osmosis.osmbinary.Fileformat$BlobHeader$1.parsePartialFrom(Fileformat.java:1908

Expected behavior
No errors with latest protobuf version in project.

System Information
JVM 17 on macOS

@jurmous jurmous changed the title Osmosis depends on old Protobuf library Reading PBF based maps depends on old Protobuf library Nov 29, 2024
@jalfonsocu
Copy link

Having the same problem, Linux, OpenJDK 21

@mprins
Copy link
Contributor

mprins commented Dec 11, 2024

I think that should be fixed in the dependency (which still have 3.25.0) eg. https://search.maven.org/artifact/org.openstreetmap.osmosis/osmosis-pbf2/0.49.2/jar and https://search.maven.org/artifact/org.openstreetmap.osmosis/osmosis-pbf/0.49.2/jar

even updating to the latest release in

graphhopper/core/pom.xml

Lines 108 to 112 in 4e232ac

<dependency>
<groupId>org.openstreetmap.osmosis</groupId>
<artifactId>osmosis-osm-binary</artifactId>
<version>0.48.3</version>
</dependency>

will not bring what you want, also note: https://github.com/openstreetmap/osmosis?tab=readme-ov-file#status
Perhaps if you opened a PR with osmosis it will be considered and an updated release put forward

@karussell
Copy link
Member

I've asked a related question at the osmosis repo.

@otbutz
Copy link
Contributor

otbutz commented Dec 11, 2024

https://github.com/openstreetmap/OSM-binary as mentioned in openstreetmap/osmosis#97 ?

https://github.com/openstreetmap/OSM-binary/blob/a2e364e5e7baa7da9bb24024eb50cdc29bbd4d8c/pom.xml#L34

For us:

<dependency>
  <groupId>org.openstreetmap.pbf</groupId>
  <artifactId>osmpbf</artifactId>
  <version>1.5.0</version>
</dependency>

@otbutz
Copy link
Contributor

otbutz commented Dec 11, 2024

Looks like a 1.6.0 release with updated dependencies is imminent: openstreetmap/OSM-binary#87

Edit: already available https://repo1.maven.org/maven2/org/openstreetmap/pbf/osmpbf/1.6.0/

@otbutz otbutz linked a pull request Dec 13, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants