-
Notifications
You must be signed in to change notification settings - Fork 72
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
java.io.NotSerializableException - what needs to be serializable? #155
Comments
Hi, On 10/27/2015 1:12 AM, peerden-visier wrote:
ScalaMeter needs to serialize the closure with the benchmark code to Make sure that the utils object does not get serialized. Alternatively, make the utils object and everything in it serializable. Third option is to use a
I don't see any
Aleksandar Prokopec |
I have a test that fails to complete with the following exception:
[error] Error running separate JVM: java.io.NotSerializableException: com.mycompany.test.utilities.framework.builder.MyClassImpl
[error] Classpath: /usr/bin/activator/activator-1.2.10/activator-launch-1.2.10.jar
java.io.NotSerializableException: com.mycompany.test.utilities.framework.builder.MyClassImpl
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1378)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at org.scalameter.execution.Main$.saveResult(Main.scala:39)
at org.scalameter.execution.Main$.mainMethod(Main.scala:17)
at org.scalameter.execution.Main$.main(Main.scala:10)
at org.scalameter.execution.Main.main(Main.scala)
[error] Could not run test com.mycompany.mymodule.test.benchmark.PerformanceBenchmarkSuite: java.io.NotSerializableException: com.mycompany.test.utilities.framework.builder.MyClassImpl
In this case, MyClassImpl is part of a set of utilities used to create a fairly large object that is needed for the test. Once the test is completed, this error occurs (preventing subsequent tests in the suite from starting). If I make MyClassImpl serializable, the error just shifts to another class in the same set of utilities. Setting as many as I can to be serializable, I eventually started getting into classes that I don't own and cannot modify. I'm not sure why any of these even need to be serializable.
Here is the general (simplified) structure of my suite:
and the trait it extends:
The text was updated successfully, but these errors were encountered: