7 Replies Latest reply on Apr 2, 2002 3:29 PM by vysh

    UndeclaredThrowableException: java.io.NotSerializableExcepti

    dof_mbr390

      Hi all,

      I'm trying to get a many to many cmr working with jboss3.0.0alpha.

      I have created two beans - Student and Module, each contains a collection of the other. In the postgres db there is a registration table which this relationship maps onto.

      Jboss finds no errors on deployment, however when i try running some junit tests on it i get the following :
      [junit] 1) test_getModules(test.entityBeans.StudentTest)
      [junit] java.lang.reflect.UndeclaredThrowableException: java.io.NotSerializableException: org.jboss.ejb.plugins.cmp.jdbc.bridge.Relatio
      nSet
      [junit] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
      [junit] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
      [junit] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
      [junit] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker_Stub.invoke(Unknown Source)
      [junit] at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(GenericProxy.java:369)
      [junit] at org.jboss.ejb.plugins.jrmp.interfaces.EntityProxy.invoke(EntityProxy.java:133)
      [junit] at $Proxy1.getModules(Unknown Source)
      [junit] at test.entityBeans.StudentTest.test_getModules(StudentTest.java:107)


      I've attached all the relevant files (tar.gz format)

      thanks in advance

      dof.

        • 1. Re: UndeclaredThrowableException: java.io.NotSerializableExc
          c-ker...

          Are you sure that you are accessing the cmr-accessors from a local client?

          • 2. Re: UndeclaredThrowableException: java.io.NotSerializableExc
            dof_mbr390

            O.K. I've sorted myself out, it was my fault for not reading the "small print" ...

            Why is this restriction in place ? Is it jboss specific or something which affects all ejb containers ? Will jboss eventually support this?


            thanks

            dof.

            • 3. Re: UndeclaredThrowableException: java.io.NotSerializableExc
              dsundstrom

              It is in the EJB 2.0 spec.

              • 4. Re: UndeclaredThrowableException: java.io.NotSerializableExc
                ppetit

                hi,
                you can use a session bean as a "front-end" to your entity beans. You make it manage Collections of your entity beans as well as the business methods.
                This session bean is then a "local" client for your entity beans.
                I think that's the best way to access entity beans involved in CMR.

                hope this helps...
                Philippe

                • 5. Re: UndeclaredThrowableException: java.io.NotSerializableExc
                  dsundstrom

                  Yes, you can use a session bean frount-end. I usually add these methods directly to my Entity and do local-remote conversions.

                  • 6. Re: UndeclaredThrowableException: java.io.NotSerializableExc
                    jay_m

                    hi,
                    i am new to thios junit/ jboss testing
                    i am getting the same problem, how did you fix it?

                    thanks

                    • 7. Re: UndeclaredThrowableException: java.io.NotSerializableExc
                      vysh

                      I have an session bean which wraps around an Object and calls the methods on this objects. The business methods in the bean delegate to the object which the bean wraps.
                      I am also getting the below exception.

                      com.nextel.util.dbx.NxtDatabase
                      at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
                      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
                      at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1841)
                      at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480)
                      at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214)
                      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
                      at java.io.ObjectOutputStream.outputArray(ObjectOutputStream.java:1098)
                      at java.io.ObjectOutputStream.checkSubstitutableSpecialClasses(ObjectOutputStream.java:456)
                      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:361)
                      at org.jboss.ejb.plugins.jrmp.interfaces.RemoteMethodInvocation.writeExternal(RemoteMethodInvocation.java:248)
                      at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1172)
                      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
                      at java.rmi.MarshalledObject.(MarshalledObject.java:95)
                      at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.createMarshalledObject(GenericProxy.java:396)
                      at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:244)
                      at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:182)
                      at $Proxy0.create(Unknown Source)
                      at com.nextel.core.util.iterator.CachedObjectManagerFactory.getCachedValueManager(CachedObjectManagerFactory.java:43)