-
Notifications
You must be signed in to change notification settings - Fork 99
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
XStream serialization broken on JDK 17 #3288
Comments
Hi,
We outlined this bug last Friday.
This bug is caused by the use of an old version of xstream, not compatible with jdk17
We tried with success the last version of xstream but more test must be done
Nicolas
… Le 24 janv. 2022 à 05:03, Alexis Drogoul ***@***.***> a écrit :
Describe the bug
When running the network tests, which make use of XStream for serialising / deserialising messages and agents, the following error appears :
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module
And adding the JVM option --add-opens java.base/java.util=ALL-UNNAMED (described in x-stream/xstream#262 (comment)) changes the error, but the serialisation still breaks.
java.lang.NoClassDefFoundError: Could not initialize class com.thoughtworks.xstream.converters.extended.DynamicProxyConverter
reportAndThrowIfNeeded : Java error: NoClassDefFoundError
at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:833)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:574)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:496)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:465)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:411)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:378)
at ummisco.gama.serializer.factory.StreamConverter.loadAndBuildNetwork(StreamConverter.java:58)
at ummisco.gama.serializer.factory.StreamConverter.convertNetworkObjectToStream(StreamConverter.java:73)
at ummisco.gama.network.common.CompositeGamaMessage.<init>(CompositeGamaMessage.java:23)
at ummisco.gama.network.common.Connector.send(Connector.java:136)
at ummisco.gama.network.skills.NetworkSkill.effectiveSend(NetworkSkill.java:430)
at msi.gama.extensions.messaging.MessagingSkill.primSendMessage(MessagingSkill.java:113)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.thoughtworks.xstream.converters.extended.DynamicProxyConverter
Problem is that the whole network plugin, written by @gnoubi relies on it, as well as the saving of simulations written by @benoitgaudou ...
To Reproduce
Run the tests on GAMA 1.8.2 on JDK 17.
Expected behavior
No error.
Desktop (please complete the following information):
OS: macOS Big Sur
PC Model: MBP 16
GAMA version: [e.g. git, 1.7.1, etc.]
Java version: [e.g. 1.8]
Graphics cards / Display system: [can be useful for displays, OpenGL problems]
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were assigned.
|
OK. Thanks. I've made myself some very basic and preliminary tests with XStream 1.4.18 (http://x-stream.github.io/download.html) and MXParser, and it solves this issue, but now there is another one:
when running the series of tests on interaction. Since XStream moved from a blacklist to a whitelist based management of "authorised" classes, does it mean we need to add all possible classes as "authorised" at startup ? And how to do it ? |
- a new version of XStream library (1.4.18) - a static initialization of the data streamer (should be thread safe) - a "whitelisting" of all classes to avoir security errors Please test more thoroughly...
I've figured it out (http://x-stream.github.io/security.html) I've pushed a possible fix. Please test. Especially the static initialization of the instance of XStream. It is normally thread safe, but in case you need one instance per agent / model / message sending/receiving, it's not too complex to turn it into a method called by the registration of converters. |
While testing the serialize plugin models I found out that some of them (
So I implemented a converter for GamaColor ( in this commit ) and all tests seem to pass now, but maybe there are more unsupported types. |
More generally it seems that the serialization does not work anymore. It is supposed to make agents move toward the target. When clicking on the reverse step button, agents are expected to go back toward their initial position. |
@benoitgaudou @lesquoyb @gnoubi can we have a clear view of what is working and not in the serialisation ? The problem with XStream seems to be solved, but you seem to imply that we have other issues ? If so, would it be possible to open specific issues and see if they can be solved ? Otherwise they will be buried here and we take the risk of releasing a version where it does not work... |
Thanks, i did not follow this issue, so #3334 seems to be related with this. |
It also seems that #2828 is related to xstream |
Problèmes pour run les tests de network sur Gama 1.8.2 :
Le fichier MqttException semble manquer donc impossible de vérifier si le problème initiale est résolé |
Bonjour
La bibliothèque était présente dans les lib de network. N’aurait elle pas été supprimée ?
Nico
Nicolas Marilleau
UMI 209 UMMISCO IRD/UPMC
Chercheur invité Femto-st
Institut de Recherche pour le Développement
32 avenue Henri Varagnat
93143 Bondy
Fixe : 0148027901
Mobile: 0688334906
… Le 4 mai 2022 à 13:12, Lucas Grosjean ***@***.***> a écrit :
Problèmes pour run les tests de network sur Gama 1.8.2 :
1 occurence in Tests for ummisco.gama.network0 at cycle 0: Java error: NoClassDefFoundError
in
NoClassDefFoundError: org/eclipse/paho/client/mqttv3/MqttException
ummisco.gama.network.skills.NetworkSkill.connectToServer(NetworkSkill.java:240)
gaml.additions.network.GamlAdditions.lambda$3(GamlAdditions.java:68)
msi.gaml.compilation.GamaHelper.run(GamaHelper.java:73)
msi.gaml.compilation.IGamaHelper.run(IGamaHelper.java:49)
msi.gaml.statements.PrimitiveStatement.privateExecuteIn(PrimitiveStatement.java:100)
msi.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:46)
msi.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:62)
in agent Tests for ummisco.gama.network0
Le fichier MqttException semble manquer donc impossible de vérifier si le problème initiale est résolé
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
Ou peut être que la lib doit simplement être mise à jour
Nico
Nicolas Marilleau
UMI 209 UMMISCO IRD/UPMC
Chercheur invité Femto-st
Institut de Recherche pour le Développement
32 avenue Henri Varagnat
93143 Bondy
Fixe : 0148027901
Mobile: 0688334906
… Le 4 mai 2022 à 13:38, Nicolas Marilleau ***@***.***> a écrit :
Bonjour
La bibliothèque était présente dans les lib de network. N’aurait elle pas été supprimée ?
Nico
Nicolas Marilleau
UMI 209 UMMISCO IRD/UPMC
Chercheur invité Femto-st
Institut de Recherche pour le Développement
32 avenue Henri Varagnat
93143 Bondy
Fixe : 0148027901
Mobile: 0688334906
>> Le 4 mai 2022 à 13:12, Lucas Grosjean ***@***.***> a écrit :
>>
>
> Problèmes pour run les tests de network sur Gama 1.8.2 :
>
> 1 occurence in Tests for ummisco.gama.network0 at cycle 0: Java error: NoClassDefFoundError
> in
> NoClassDefFoundError: org/eclipse/paho/client/mqttv3/MqttException
> ummisco.gama.network.skills.NetworkSkill.connectToServer(NetworkSkill.java:240)
> gaml.additions.network.GamlAdditions.lambda$3(GamlAdditions.java:68)
> msi.gaml.compilation.GamaHelper.run(GamaHelper.java:73)
> msi.gaml.compilation.IGamaHelper.run(IGamaHelper.java:49)
> msi.gaml.statements.PrimitiveStatement.privateExecuteIn(PrimitiveStatement.java:100)
> msi.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:46)
> msi.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:62)
> in agent Tests for ummisco.gama.network0
> Le fichier MqttException semble manquer donc impossible de vérifier si le problème initiale est résolé
>
> —
> Reply to this email directly, view it on GitHub, or unsubscribe.
> You are receiving this because you were mentioned.
|
Updating : org.eclipse.paho.client.mqttv3-1.0.2-3.jar to org.eclipse.paho.client.mqttv3-1.2.5
Mis à jour de la librarie org.eclipse.paho.client.mqttv3 de sa version 1.0.2-3 vers sa version 1.2.5. |
I have same issue on using JMapper with java v17. you can find more detail on this link. |
Describe the bug
When running the network tests, which make use of XStream for serialising / deserialising messages and agents, the following error appears :
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module
And adding the JVM option
--add-opens java.base/java.util=ALL-UNNAMED
(described in x-stream/xstream#262 (comment)) changes the error, but the serialisation still breaks.Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.thoughtworks.xstream.converters.extended.DynamicProxyConverter
Problem is that the whole
network
plugin, written by @gnoubi relies on it, as well as the saving of simulations written by @benoitgaudou ...To Reproduce
Run the tests on GAMA 1.8.2 on JDK 17.
Expected behavior
No error.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: