$ java -version
openjdk version "17.0.1" 2021-10-19
$ java -jar ysoserial.jar CommonsCollections4 'calc'
Error while generating or serializing payload
java.lang.IllegalAccessError: class ysoserial.payloads.util.Gadgets (in unnamed module @0x68fb2c38) cannot access class com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl (in module java.xml) because module java.xml does not export com.sun.org.apache.xalan.internal.xsltc.trax to unnamed module @0x68fb2c38
at ysoserial.payloads.util.Gadgets.createTemplatesImpl(Gadgets.java:102)
at ysoserial.payloads.CommonsCollections4.getObject(CommonsCollections4.java:32)
at ysoserial.payloads.CommonsCollections4.getObject(CommonsCollections4.java:26)
at ysoserial.GeneratePayload.main(GeneratePayload.java:34)