I have been working on Cobertura for couple months and recently I'm getting an error saying that "Error Reading .ser file" from particular target location.Does anyone has idea why am I getting the below error:
Cobertura maven plugin version:2.7
Java version : 1.8
[INFO] Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[ERROR] Cobertura: Error reading file C:\view\
xyz\target\cobertura\cobertura.s
er: null
java.io.EOFException: null
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputSt
ream.java:2626) ~[na:1.8.0_102]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1321) ~[
na:1.8.0_102]
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:20
18) ~[na:1.8.0_102]
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1942)
~[na:1.8.0_102]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
808) ~[na:1.8.0_102]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353) ~[
na:1.8.0_102]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373) ~[na
:1.8.0_102]
at java.util.HashMap.readObject(HashMap.java:1404) ~[na:1.8.0_102]
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43) ~[na:1.8.0_102]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_102]
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:105
8) ~[na:1.8.0_102]
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1909)
~[na:1.8.0_102]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
808) ~[na:1.8.0_102]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353) ~[
na:1.8.0_102]
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:20
18) ~[na:1.8.0_102]
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:50
3) ~[na:1.8.0_102]
at net.sourceforge.cobertura.coveragedata.CoverageDataContainer.readObje
ct(CoverageDataContainer.java:321) ~[cobertura-2.1.1.jar:2.1.1]
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43) ~[na:1.8.0_102]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_102]
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:105
8) ~[na:1.8.0_102]
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1909)
~[na:1.8.0_102]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
808) ~[na:1.8.0_102]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353) ~[
na:1.8.0_102]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373) ~[na
:1.8.0_102]
at java.util.HashMap.readObject(HashMap.java:1404) ~[na:1.8.0_102]
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43) ~[na:1.8.0_102]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_102]
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:105
8) ~[na:1.8.0_102]
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1909)
~[na:1.8.0_102]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
808) ~[na:1.8.0_102]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353) ~[
na:1.8.0_102]
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:20
18) ~[na:1.8.0_102]
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:50
3) ~[na:1.8.0_102]
at net.sourceforge.cobertura.coveragedata.CoverageDataContainer.readObje
ct(CoverageDataContainer.java:321) ~[cobertura-2.1.1.jar:2.1.1]
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43) ~[na:1.8.0_102]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_102]
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:105
8) ~[na:1.8.0_102]
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1909)
~[na:1.8.0_102]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
808) ~[na:1.8.0_102]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353) ~[
na:1.8.0_102]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373) ~[na
:1.8.0_102]
at java.util.HashMap.readObject(HashMap.java:1404) ~[na:1.8.0_102]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.
0_102]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62) ~[na:1.8.0_102]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43) ~[na:1.8.0_102]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_102]
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:105
8) ~[na:1.8.0_102]
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1909)
~[na:1.8.0_102]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
808) ~[na:1.8.0_102]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353) ~[
na:1.8.0_102]
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:20
18) ~[na:1.8.0_102]
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:50
3) ~[na:1.8.0_102]
at net.sourceforge.cobertura.coveragedata.CoverageDataContainer.readObje
ct(CoverageDataContainer.java:321) ~[cobertura-2.1.1.jar:2.1.1]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.
0_102]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62) ~[na:1.8.0_102]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43) ~[na:1.8.0_102]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_102]
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:105
8) ~[na:1.8.0_102]
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1909)
~[na:1.8.0_102]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
808) ~[na:1.8.0_102]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353) ~[
na:1.8.0_102]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373) ~[na
:1.8.0_102]
at net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler.loadCo
verageData(CoverageDataFileHandler.java:85) ~[cobertura-2.1.1.jar:2.1.1]
at net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler.loadCo
verageData(CoverageDataFileHandler.java:62) ~[cobertura-2.1.1.jar:2.1.1]
at net.sourceforge.cobertura.dsl.Cobertura.getProjectDataInstance(Cobert
ura.java:146) [cobertura-2.1.1.jar:2.1.1]
at net.sourceforge.cobertura.dsl.Cobertura.report(Cobertura.java:122) [c
obertura-2.1.1.jar:2.1.1]
at net.sourceforge.cobertura.reporting.ReportMain.parseArgumentsAndRepor
t(ReportMain.java:91) [cobertura-2.1.1.jar:2.1.1]
at net.sourceforge.cobertura.reporting.ReportMain.generateReport(ReportM
ain.java:141) [cobertura-2.1.1.jar:2.1.1]
at net.sourceforge.cobertura.reporting.ReportMain.main(ReportMain.java:1
51) [cobertura-2.1.1.jar:2.1.1]
Report time: 1031ms
Thanks in advance.
Usually .ser files gets locked only when you don't have enough memory that has been allocated for cobertura to generate the report. The solution should be
1) Delete all unnecessary test class files from src/test/java and run cobertura or
2) Increase the memory size of cobertura, something like below
In pom.xml just change the cobertura.maxmem size to whatever we want and We have option like ignoring few classes while generating report also.
3) And there is one more possibility that your sure-fire plugin version is not supported. If above two solutions are not working then try updating sure-fire version like below (maven-surefire-plugin should be 2.12):
Hope it's useful.