java.io.NotSerializableException

64 views
Skip to first unread message

Heiko Seeberger

unread,
Apr 15, 2010, 10:51:42 AM4/15/10
to specs...@googlegroups.com
Hi,

I am using Pax Exam to run OSGi in container tests under Java 6 and Scala 2.8.0.RC1 and specs 1.6.4.
Here is the error (I already got for 2.8.0.Beta1):

org.ops4j.pax.exam.spi.container.TestContainerException: Remote exception
at org.ops4j.pax.exam.rbc.client.RemoteBundleContextClient$1.invoke(RemoteBundleContextClient.java:125)
at $Proxy8.call(Unknown Source)
at org.ops4j.pax.exam.junit.internal.JUnit4TestMethod.invoke(JUnit4TestMethod.java:157)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:105)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:86)
at org.ops4j.pax.exam.junit.internal.JUnit4MethodRoadie.runBeforesThenTestThenAfters(JUnit4MethodRoadie.java:60)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
at org.ops4j.pax.exam.junit.JUnit4TestRunner.invokeTestMethod(JUnit4TestRunner.java:246)
at org.ops4j.pax.exam.junit.JUnit4TestRunner.runMethods(JUnit4TestRunner.java:196)
at org.ops4j.pax.exam.junit.JUnit4TestRunner$2.run(JUnit4TestRunner.java:186)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
at org.ops4j.pax.exam.junit.JUnit4TestRunner.run(JUnit4TestRunner.java:182)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: java.rmi.UnmarshalException: Error unmarshaling return; nested exception is: 
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.specs.specification.Result
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:227)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
at $Proxy7.remoteCall(Unknown Source)
at org.ops4j.pax.exam.rbc.client.RemoteBundleContextClient$1.invoke(RemoteBundleContextClient.java:111)
... 23 more
Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.specs.specification.Result
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:225)
... 28 more
Caused by: java.io.NotSerializableException: org.specs.specification.Result
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:343)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)

Any ideas?

Heiko

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Stambecco, highly scalable computing: stambecco.org

etorreborre

unread,
Apr 15, 2010, 11:03:13 AM4/15/10
to specs-users
Well I don't know but since it's fresh from the oven maybe you want to
try this one out: http://scala-tools.org/repo-snapshots/org/scala-tools/testing/specs_2.8.0.RC1/1.6.5-SNAPSHOT/

Eric.

On Apr 16, 12:51 am, Heiko Seeberger <heiko.seeber...@googlemail.com>
wrote:


> Hi,
>
> I am using Pax Exam to run OSGi in container tests under Java 6 and Scala
> 2.8.0.RC1 and specs 1.6.4.
> Here is the error (I already got for 2.8.0.Beta1):
>
> org.ops4j.pax.exam.spi.container.TestContainerException: Remote exception
> at

> org.ops4j.pax.exam.rbc.client.RemoteBundleContextClient$1.invoke(RemoteBund leContextClient.java:125)


> at $Proxy8.call(Unknown Source)
> at
> org.ops4j.pax.exam.junit.internal.JUnit4TestMethod.invoke(JUnit4TestMethod. java:157)
> at
> org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:105 )
> at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:86)
> at

> org.ops4j.pax.exam.junit.internal.JUnit4MethodRoadie.runBeforesThenTestThen Afters(JUnit4MethodRoadie.java:60)


> at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84)
> at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
> at

> org.ops4j.pax.exam.junit.JUnit4TestRunner.invokeTestMethod(JUnit4TestRunner .java:246)


> at
> org.ops4j.pax.exam.junit.JUnit4TestRunner.runMethods(JUnit4TestRunner.java: 196)
> at
> org.ops4j.pax.exam.junit.JUnit4TestRunner$2.run(JUnit4TestRunner.java:186)
> at
> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
> at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
> at org.ops4j.pax.exam.junit.JUnit4TestRunner.run(JUnit4TestRunner.java:182)
> at
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:6 2)
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(A bstractDirectoryTestSuite.java:140)
> at

> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abstract DirectoryTestSuite.java:127)


> at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3 9)
> at

> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java:25)


> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Surefire Booter.java:345)
> at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:10 09)
> Caused by: java.rmi.UnmarshalException: Error unmarshaling return; nested
> exception is:
> java.io.WriteAbortedException: writing aborted;
> java.io.NotSerializableException: org.specs.specification.Result
> at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:227)
> at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
> at
> java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObje ctInvocationHandler.java:178)
> at

> java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocation Handler.java:132)
> at $Proxy7.remoteCall(Unknown Source)
> at
> org.ops4j.pax.exam.rbc.client.RemoteBundleContextClient$1.invoke(RemoteBund leContextClient.java:111)

> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:343)
> at sun.rmi.transport.Transport$1.run(Transport.java:159)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
> at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java :790)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java: 649)
> at

> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.j ava:886)

etorreborre

unread,
Apr 15, 2010, 11:10:17 AM4/15/10
to specs-users
Hmm, now that I get to actually *read* your message (it's 1am here, I
should go to bed,...) it looks like you're trying to serialize a specs
object (org.specs.specification.Result) which is not serializable. My
guess is that one exception thrown by specs carries around a the
result object. When it's converted to a JUnit assertion failure, that
one tries to be serialized, but can't because recursively it contains
something that's not serializable.

Can you reproduce that on a tiny example?

Eric.

On Apr 16, 12:51 am, Heiko Seeberger <heiko.seeber...@googlemail.com>
wrote:

> Hi,
>
> I am using Pax Exam to run OSGi in container tests under Java 6 and Scala
> 2.8.0.RC1 and specs 1.6.4.
> Here is the error (I already got for 2.8.0.Beta1):
>
> org.ops4j.pax.exam.spi.container.TestContainerException: Remote exception
> at

> org.ops4j.pax.exam.rbc.client.RemoteBundleContextClient$1.invoke(RemoteBund leContextClient.java:125)
> at $Proxy8.call(Unknown Source)
> at


> org.ops4j.pax.exam.junit.internal.JUnit4TestMethod.invoke(JUnit4TestMethod. java:157)
> at
> org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:105 )
> at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:86)
> at

> org.ops4j.pax.exam.junit.internal.JUnit4MethodRoadie.runBeforesThenTestThen Afters(JUnit4MethodRoadie.java:60)


> at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84)
> at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
> at

> org.ops4j.pax.exam.junit.JUnit4TestRunner.invokeTestMethod(JUnit4TestRunner .java:246)


> at
> org.ops4j.pax.exam.junit.JUnit4TestRunner.runMethods(JUnit4TestRunner.java: 196)
> at
> org.ops4j.pax.exam.junit.JUnit4TestRunner$2.run(JUnit4TestRunner.java:186)
> at
> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
> at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
> at org.ops4j.pax.exam.junit.JUnit4TestRunner.run(JUnit4TestRunner.java:182)
> at

> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:6 2)
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(A bstractDirectoryTestSuite.java:140)
> at

> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abstract DirectoryTestSuite.java:127)


> at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at

> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3 9)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at


> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Surefire Booter.java:345)
> at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:10 09)

> Caused by: java.rmi.UnmarshalException: Error unmarshaling return; nested
> exception is:
> java.io.WriteAbortedException: writing aborted;
> java.io.NotSerializableException: org.specs.specification.Result
> at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:227)
> at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
> at

> java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObje ctInvocationHandler.java:178)
> at
> java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocation Handler.java:132)
> at $Proxy7.remoteCall(Unknown Source)
> at
> org.ops4j.pax.exam.rbc.client.RemoteBundleContextClient$1.invoke(RemoteBund leContextClient.java:111)

> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:343)
> at sun.rmi.transport.Transport$1.run(Transport.java:159)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
> at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java :790)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java: 649)
> at

> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.j ava:886)

Heiko Seeberger

unread,
Apr 15, 2010, 11:20:56 AM4/15/10
to specs...@googlegroups.com
Hi,

On 15 April 2010 17:10, etorreborre <etorr...@gmail.com> wrote:

Can you reproduce that on a tiny example?

I'm sorry: It's not me myself trying to serialize something but Pax Exam, an in-container testing tool for OSGi. The actual test is pretty slim, but in order to run it and reproduce the error you have to run Pax Exam. That's in fact pretty easy if you are not afraid of Maven.

Download it or clone the repo and switch to branch 3-hseeberger.
Then run mvn clean install in the root directory with Maven 2.2.1.

Just to motivate you: ScalaTest has been working, but I switched to specs ;-)

Thanks,

Heiko

etorreborre

unread,
Apr 15, 2010, 6:57:16 PM4/15/10
to specs-users
I can confirm that the issue is with specs throwing a Failure
exception containing a Result object.

The solution to this issue, I think, is just to mark this object as
transient as it is not used for reporting.

I've uploaded a new snapshot version, please tell me if it works now.

Eric.

On Apr 16, 1:20 am, Heiko Seeberger <heiko.seeber...@googlemail.com>
wrote:
> Hi,
>
> On 15 April 2010 17:10, etorreborre <etorrebo...@gmail.com> wrote:
>
>
>
> > Can you reproduce that on a tiny example?
>
> I'm sorry: It's not me myself trying to serialize something but Pax
> Exam<http://wiki.ops4j.org/display/paxexam/Pax+Exam>,
> an in-container testing tool for OSGi. The actual test is pretty slim, but
> in order to run it and reproduce the error you have to run Pax Exam. That's
> in fact pretty easy if you are not afraid of Maven.
>
> Here is the code:http://github.com/weiglewilczek/scalamodules/tree/3-hseeberger
> Download it or clone the repo and switch to branch 3-hseeberger.
> Then run mvn clean install in the root directory with Maven 2.2.1.
>
> Just to motivate you: ScalaTest has been working, but I switched to specs
> ;-)
>
> Thanks,
>
> Heiko
>
> Company: weiglewilczek.com
> Blog: heikoseeberger.name
> Follow me: twitter.com/hseeberger
> OSGi on Scala: scalamodules.org
> Lift, the simply functional web framework: liftweb.net
> Stambecco, highly scalable computing: stambecco.org

--
You received this message because you are subscribed to the Google Groups "specs-users" group.
To post to this group, send email to specs...@googlegroups.com.
To unsubscribe from this group, send email to specs-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/specs-users?hl=en.

Heiko Seeberger

unread,
Apr 16, 2010, 3:48:08 AM4/16/10
to specs...@googlegroups.com
Eric,

You are amazing! I report an error showing up only in "some strange scenarios" and you fix it within some hours. Thanks a lot!

Heiko
--
Heiko Seeberger


Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Stambecco, highly scalable computing: stambecco.org

etorreborre

unread,
Apr 16, 2010, 4:00:44 AM4/16/10
to specs-users
Well, when it's as easy as writing @transient somewhere, I'm happy to
do it. That being I'm actually *happy* that this was only a simple fix
to do!

On Apr 16, 5:48 pm, Heiko Seeberger <heiko.seeber...@googlemail.com>
wrote:
> Eric,
>
> You are amazing! I report an error showing up only in "some strange
> scenarios" and you fix it within some hours. Thanks a lot!
>
> Heiko
>
> > specs-users...@googlegroups.com<specs-users%2Bunsubscribe@googlegr oups.com>
> > .
Reply all
Reply to author
Forward
0 new messages