Despite this class implements Serializable, I get
NotSerializableException when I try to do so.
I am using Axis 1.1.1. I searched the Issue database but I did not
find this issue anywhere (resolved or unresolved). I even searched this
list but to no avail.
I am hesitant to report it as I am not a very experienced Java
programmer. I have had my head in databases for the last 15 years. My
understanding is that this would be a bug.
Please excuse me if I'm being ignorant somehow and just kindly point out
what I'm not understanding.
Below is the sample code and the exception generated.
Michael
@Test
public void testSerial() {
AxisFault af = new AxisFault("test");
// Test serialization
try {
FileOutputStream os = new
FileOutputStream("serial.txt");
ObjectOutputStream oos = new ObjectOutputStream(os);
oos.writeObject(af);
oos.close();
os.close();
} catch(Exception e) {
e.printStackTrace();
}
}
java.io.NotSerializableException: org.apache.axis2.AxisFault$FaultReason
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at java.util.ArrayList.writeObject(ArrayList.java:569)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1
290)
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:13
75)
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1
290)
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at
com.ipd.esb.job.EFTRoster.TestEFTRosterBatch.testSerial(TestEFTRosterBat
ch.java:215)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethod
Runner.java:99)
at
org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRun
ner.java:81)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAf
terRunner.java:34)
at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.j
ava:75)
at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45
)
at
org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestC
lassMethodsRunner.java:71)
at
org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRu
nner.java:35)
at
org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRun
ner.java:42)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAf
terRunner.java:34)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4Tes
tReference.java:38)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.ja
va:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:196)
This message is private and confidential. If you have received it in error,
please notify the sender and remove it from your system.