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

Incompatible with new Java versions #355

Open
Qinnnnn opened this issue Jun 6, 2023 · 3 comments
Open

Incompatible with new Java versions #355

Qinnnnn opened this issue Jun 6, 2023 · 3 comments

Comments

@Qinnnnn
Copy link
Collaborator

Qinnnnn commented Jun 6, 2023

SILO is not compatible with new Java versions like Java 17.
Need to test different Java versions and adapt SILO to the latest. (?)

@key2000
Copy link
Collaborator

key2000 commented Jun 8, 2023

Thank you Qin,
In my case, Java 11.0.18 did not work, but 11.0.15 did.
This may be specific to my computer.

@key2000
Copy link
Collaborator

key2000 commented Jun 8, 2023

By the way, when simulating both road and public transport in Matsim, the speed of public transport vehicles becomes very slow. Based on my previous experience with public transport simulations, I remember that reducing the flowCapacityFactor and storageCapacityFactor slows down the vehicle speed, and setting them to 1 achieves the desired speed. If you happen to know how to properly control the speed of public transport vehicles when decreasing the CapacityFactor in a simulation that combines road and public transport, I would greatly appreciate any advice you can provide.

@jakobrehmann
Copy link
Collaborator

jakobrehmann commented Jun 28, 2023

@Qinnnnn I've run into the same problem with Java versions. This is a bit of an issue for the SILO-MATSim Integration, because newest version of MATSim relies on Java 17.

I've started to look into why migration to 17 doesn't work seamlessly, and I'll share what I've figured out so far. The error I get is...

java.lang.NullPointerException: Cannot invoke "javax.script.Compilable.compile(String)" because "compileEngine" is null

	at de.tum.bgu.msm.util.js.JavaScriptCalculator.compileScript(JavaScriptCalculator.java:50)
	at de.tum.bgu.msm.util.js.JavaScriptCalculator.<init>(JavaScriptCalculator.java:27)
	at de.tum.bgu.msm.models.relocation.DwellingUtilityStrategyImpl.<init>(DwellingUtilityStrategyImpl.java:12)
	at de.tum.bgu.msm.ModelBuilderMuc.getModelContainerForMuc(ModelBuilderMuc.java:88)
	at de.tum.bgu.msm.transportModel.matsim.SiloMucTest.runThisTest(SiloMucTest.java:58)
	at de.tum.bgu.msm.transportModel.matsim.SiloMucTest.testMain(SiloMucTest.java:40)
...

If I am understanding it correctly, some of SILO's models/methods are in the form of Javascript scripts. These scripts loaded and executed using the class JavaScriptCalculator; this class actually is part of MITO and not SILO. (Note: It is also tagged as deprecated). Within JavaScriptCalculator, the javascript engine nashorn is loaded.

nashorn was deprecated in Java 11. This is why the following warning message always shows up in the logs when SILO is run: "Warning: Nashorn engine is planned to be removed from a future JDK release"

nashorn was ultimately removed in Java 15. Thus, when running SILO with Java 17, we get the "compileEngine" is null error.

What can we do about this? My colleague @rakow suggested that we could load nashorn as a maven dependency. Alternatively, would it be possible to just translate the javascript code into java?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants