java.io.NotSerializableException: java.io.StringWriter

Stack Overflow | David M. Karr | 2 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Jenkins Pipeline NotSerializableException: groovy.json.internal.LazyMap

    Stack Overflow | 10 months ago | Sunvic
    java.io.NotSerializableException: groovy.json.internal.LazyMap
  2. 0

    Why I get this java.io.NotSerializableException error

    Google Groups | 3 months ago | Kristian
    java.io.NotSerializableException: com.somescripts.groovy.test
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    I'm using this script, which works properly on the groovy commandline interpreter: def testCaseSets = [ 'config.upgrade.authentication.authentication_parameters.arangobench': [ ""], 'dump.importing': ["", "--cluster true"], 'shell_server': ["", "--cluster true --testBuckets 4/1 ", "--cluster true --testBuckets 4/2 ", "--cluster true --testBuckets 4/3 ", "--cluster true --testBuckets 4/4 "], 'shell_server_aql': ["", "--cluster true --testBuckets 4/1 ", "--cluster true --testBuckets 4/2 ", "--cluster true --testBuckets 4/3 ", "--cluster true --testBuckets 4/4 "], 'arangosh': ["", "--cluster true --testBuckets 4/1 ", "--cluster true --testBuckets 4/2 ", "--cluster true --testBuckets 4/3 ", "--cluster true --testBuckets 4/4 "], ] print("getting keyset\n") testCaseNames = testCaseSets.keySet() print("done keyset is: ${testCaseNames}\n") m = testCaseNames.size() print("size: ${m}\n") int n = 0; for (int i = 0; i < m; i++) { print("in loop\n") def unitTestName = testCaseNames.getAt(i); print("unitTestName: ${unitTestName}\n") def thisTest = testCaseSets[unitTestName] print( "generating short name:\n") def shortName = unitTestName.take(12) print("generated short name: ${shortName}\n") } Using it in the jenkins pipeline script will make _testCaseSets.keySet()_ throw this ecxeption: [Pipeline] stage [Pipeline] { (cloning source) [Pipeline] echo getting keyset [Pipeline] echo done keyset is: [config.upgrade.authentication.authentication_parameters.arangobench, dump.importing, shell_server, shell_server_aql, arangosh] [Pipeline] echo size: 5 [Pipeline] } [Pipeline] // stage [Pipeline] End of Pipeline java.io.NotSerializableException: java.util.HashMap$KeySet at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860) at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65) at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56) at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50) at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343) at java.util.HashMap.writeObject(HashMap.java:1129) at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:271) ... Caused by: an exception which occurred: in field delegate in field closures in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@69005cb8

    Jenkins JIRA | 7 months ago | Wilfried Goesgens
    java.io.NotSerializableException: java.util.HashMap$KeySet

  1. davidvanlaatum 14 times, last 11 months ago
7 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.io.NotSerializableException

    java.io.StringWriter

    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject()
  2. JBoss Marshalling River
    BlockMarshaller.writeObject
    1. org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
    2. org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
    3. org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
    3 frames
  3. JBoss Marshalling API
    MarshallerObjectOutputStream.writeObjectOverride
    1. org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
    1 frame
  4. JBoss Marshalling River
    RiverObjectOutputStream.writeObjectOverride
    1. org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
    1 frame
  5. Java RT
    Method.invoke
    1. java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
    2. java.util.HashMap.internalWriteEntries(HashMap.java:1777)
    3. java.util.HashMap.writeObject(HashMap.java:1354)
    4. sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)
    5. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    6. java.lang.reflect.Method.invoke(Method.java:498)
    6 frames