OTP in Windows with Java 16

250 views
Skip to first unread message

Alain L'Hostis

unread,
Jul 2, 2021, 9:23:39 AM7/2/21
to OpenTripPlanner Users

Hi all,
I get an error in Windows with java 16, just when it should write the 'graph.obj' file. end of the log below.
My command line is
java -Xmx3G -jar otp-1.5.0-shaded.jar -- build

Should I come back to Java 8?

15:06:49.489 INFO (Graph.java:815) Writing graph D:\Desktop\otp\graphs\PACA\Graph.obj ...
Exception in thread "main" java.lang.ExceptionInInitializerError
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:78)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
        at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:350)
        at java.base/java.lang.Class.newInstance(Class.java:642)
        at com.esotericsoftware.kryo.factories.ReflectionSerializerFactory.makeSerializer(ReflectionSerializerFactory.java:59)
        at com.esotericsoftware.kryo.factories.ReflectionSerializerFactory.makeSerializer(ReflectionSerializerFactory.java:43)
        at com.esotericsoftware.kryo.Kryo.getDefaultSerializer(Kryo.java:375)
        at com.esotericsoftware.kryo.util.DefaultClassResolver.registerImplicit(DefaultClassResolver.java:74)
        at com.esotericsoftware.kryo.Kryo.getRegistration(Kryo.java:508)
        at com.esotericsoftware.kryo.util.DefaultClassResolver.writeClass(DefaultClassResolver.java:97)
        at com.esotericsoftware.kryo.Kryo.writeClass(Kryo.java:540)
        at com.esotericsoftware.kryo.Kryo.writeClassAndObject(Kryo.java:645)
        at com.esotericsoftware.kryo.serializers.MapSerializer.write(MapSerializer.java:113)
        at com.esotericsoftware.kryo.serializers.MapSerializer.write(MapSerializer.java:39)
        at com.esotericsoftware.kryo.Kryo.writeObject(Kryo.java:575)
        at com.esotericsoftware.kryo.serializers.ObjectField.write(ObjectField.java:79)
        at com.esotericsoftware.kryo.serializers.FieldSerializer.write(FieldSerializer.java:508)
        at com.esotericsoftware.kryo.Kryo.writeClassAndObject(Kryo.java:651)
        at com.esotericsoftware.kryo.serializers.MapSerializer.write(MapSerializer.java:113)
        at com.esotericsoftware.kryo.serializers.MapSerializer.write(MapSerializer.java:39)
        at com.esotericsoftware.kryo.Kryo.writeObject(Kryo.java:575)
        at com.esotericsoftware.kryo.serializers.ObjectField.write(ObjectField.java:79)
        at com.esotericsoftware.kryo.serializers.FieldSerializer.write(FieldSerializer.java:508)
        at com.esotericsoftware.kryo.Kryo.writeClassAndObject(Kryo.java:651)
        at org.opentripplanner.routing.graph.Graph.save(Graph.java:840)
        at org.opentripplanner.routing.graph.Graph.save(Graph.java:817)
        at org.opentripplanner.graph_builder.GraphBuilder.run(GraphBuilder.java:144)
        at org.opentripplanner.standalone.OTPMain.run(OTPMain.java:103)
        at org.opentripplanner.standalone.OTPMain.main(OTPMain.java:73)
Caused by: java.lang.RuntimeException: Could not access source collection field in java.util.Collections$UnmodifiableCollection.
        at de.javakaffee.kryoserializers.UnmodifiableCollectionsSerializer.<clinit>(UnmodifiableCollectionsSerializer.java:62)
        ... 32 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field final java.util.Collection java.util.Collections$UnmodifiableCollection.c accessible: module java.base does not "opens java.util" to unnamed module @8e24743
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
        at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:177)
        at java.base/java.lang.reflect.Field.setAccessible(Field.java:171)
        at de.javakaffee.kryoserializers.UnmodifiableCollectionsSerializer.<clinit>(UnmodifiableCollectionsSerializer.java:55)
        ... 32 more

D:\Desktop\otp>cd Desktop

Leonard Ehrenfried

unread,
Jul 2, 2021, 10:43:02 AM7/2/21
to opentrippl...@googlegroups.com
The only version that OTP is tested with is Java 11. You should use that.

--
You received this message because you are subscribed to the Google Groups "OpenTripPlanner Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opentripplanner-...@googlegroups.com.

Andrew Byrd

unread,
Jul 2, 2021, 11:12:32 AM7/2/21
to Leonard Ehrenfried, OpenTripPlanner Users, Alain L'Hostis
Actually, if I’m not mistaken the 2.x branches of OTP are using Java 11, but the 1.x branches are still targeting Java 1.8. At least a quick look at the POM shows source and target version 1.8.


-Andrew


Leonard Ehrenfried

unread,
Jul 2, 2021, 11:34:29 AM7/2/21
to Andrew Byrd, OpenTripPlanner Users, Alain L'Hostis
Andrew is of course right.

OTP1 is using Java 8
OTP2 is using Java 11

--
  Leonard Ehrenfried

Alain L'Hostis

unread,
Jul 4, 2021, 8:11:23 AM7/4/21
to OpenTripPlanner Users
thanks for the indications, once I installed java 8 it works

Youssra El Moussaoui

unread,
Jul 6, 2021, 7:56:42 AM7/6/21
to OpenTripPlanner Users
Hello,

Here is the error message that appears

Youssra El Moussaouiotp.png

Andrew Byrd

unread,
Jul 6, 2021, 9:49:37 AM7/6/21
to Youssra El Moussaoui, OpenTripPlanner Users
Hi,

It looks like you may be including the dollar sign ($) in your command. In the OTP documentation, that symbol is just representing a command prompt for a regular user (as opposed to superuser), indicating that what follows should be entered on the command line. In your case it looks like the equivalent command prompt is >. You only need to type the following part starting with ‘java’, not the prompt character.

However, note that as mentioned in the previous message in the chain, OTP1 is only tested on Java 8, and OTP2 is only tested on Java 11.

-Andrew

On 6 Jul 2021, at 19:56, Youssra El Moussaoui <yous...@live.fr> wrote:

Hello,

Here is the error message that appears

Youssra El Moussaoui<otp.png>

Youssra El Moussaoui

unread,
Jul 9, 2021, 10:50:12 AM7/9/21
to OpenTripPlanner Users
Thank you for your answer,
I tried again but it looks like I can't access to my JAR file. Is it because of java's version

Have a nice day,Capture d’écran 2021-07-09 164416.png
Youssra El Moussaoui

Alain L'Hostis

unread,
Jul 12, 2021, 6:24:57 AM7/12/21
to OpenTripPlanner Users
Youssra,
be careful you must be located in the otp folder, apparently you type the command line from \Desktop
Reply all
Reply to author
Forward
0 new messages