1 Reply Latest reply on May 14, 2002 8:52 AM by eric PAPET

    Passing Remote Objects

    Michael Wax Newbie

      Attempts to pass an instance of a remote object from a custom method in an entity bean home interface to a caller who happens to be a session bean fail. Here is my situation:

      (1) Inside of a custom finder method, I get a remote object by doing a findByPrimaryKey in a helper class.

      (2) The remote object is valid: I can call getter methods on it in the helper class, causing the entity instance to be loaded from the database.

      (3) I return this remote object to the caller (a session bean).

      (4) In the session bean, the remote object does not appear to be valid. When I call a method on it, it fails to load. Instead, I get an "Object is not an instance of declaring class" exception. The stack trace appears below.

      (5) Calling a getter method on the remote object in the entity bean custom finder method should have loaded (initialized) the EJB instance. Why are we even attempting to load it again when the session bean attempts to touch the remote object?

      (6) The Stack Trace:
      [Default] The remote type in LoginSessionBean is $Proxy55
      [ComponentProperty] Activated bean ComponentProperty with id = ComponentProperty:com.vantra.volts.core.entity.ComponentPropertyKey@42277fd8
      [JAWS] Load command executing: SELECT ComponentProperty.componentId,ComponentProperty.propertyId,ComponentProperty.position,ComponentProperty.defaultValue,ComponentProperty.oca,ComponentProperty.propertyDescription FROM ComponentProperty WHERE componentId=? AND propertyId=?
      [ComponentProperty] TRANSACTION ROLLBACK EXCEPTION:Load failed; nested exception is:
      java.lang.IllegalArgumentException: object is not an instance of declaring class; nested exception is:
      java.rmi.ServerException: Load failed; nested exception is:
      java.lang.IllegalArgumentException: object is not an instance of declaring class
      [ComponentProperty] java.rmi.ServerException: Load failed; nested exception is:
      [ComponentProperty] java.lang.IllegalArgumentException: object is not an instance of declaring class
      [ComponentProperty] java.lang.IllegalArgumentException: object is not an instance of declaring class
      [ComponentProperty] at java.lang.reflect.Field.get(Native Method)
      [ComponentProperty] at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.getPkFieldValue(JDBCCommand.java:663)
      [ComponentProperty] at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.setPrimaryKeyParameters(JDBCCommand.java:364)
      [ComponentProperty] at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.setParameters(JDBCLoadEntityCommand.java:163)
      [ComponentProperty] at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.jdbcExecute(JDBCCommand.java:159)
      [ComponentProperty] at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:147)
      [ComponentProperty] at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.loadEntity(JAWSPersistenceManager.java:156)
      [ComponentProperty] at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:362)
      [ComponentProperty] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:286)
      [ComponentProperty] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:208)
      [ComponentProperty] at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:136)
      [ComponentProperty] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:133)
      [ComponentProperty] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:431)
      [ComponentProperty] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)
      [ComponentProperty] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:128)
      [ComponentProperty] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
      [ComponentProperty] at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:427)
      [ComponentProperty] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:489)
      [ComponentProperty] at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(GenericProxy.java:335)
      [ComponentProperty] at org.jboss.ejb.plugins.jrmp.interfaces.EntityProxy.invoke(EntityProxy.java:133)
      [ComponentProperty] at $Proxy55.getPropertyId(Unknown Source)
      [ComponentProperty] at com.vantra.volts.core.session.login.LoginSessionBean.generateComponentPropertyOffsetMap(LoginSessionBean.java:399)
      [ComponentProperty] at java.lang.reflect.Method.invoke(Native Method)

      Any ideas?

        • 1. Re: Passing Remote Objects
          eric PAPET Newbie

          I am the same problem !!!

          [java] java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
          [java] javax.transaction.TransactionRolledbackException: try to access method com.dev1.sysmex.fse.ejb.entity.fse.groupeItem.params.ParamItem.()V from class com.dev1.sysmex.fse.ejb.entity.fse.groupeItem.params.ParamGroupeItemBean; nested exception is:
          [java] java.lang.IllegalAccessError: try to access method com.dev1.sysmex.fse.ejb.entity.fse.groupeItem.params.ParamItem.()V from class com.dev1.sysmex.fse.ejb.entity.fse.groupeItem.params.ParamGroupeItemBean
          [java] javax.transaction.TransactionRolledbackException: try to access method com.dev1.sysmex.fse.ejb.entity.fse.groupeItem.params.ParamItem.()V from class com.dev1.sysmex.fse.ejb.entity.fse.groupeItem.params.ParamGroupeItemBean; nested exception is:
          [java] java.lang.IllegalAccessError: try to access method com.dev1.sysmex.fse.ejb.entity.fse.groupeItem.params.ParamItem.()V from class com.dev1.sysmex.fse.ejb.entity.fse.groupeItem.params.ParamGroupeItemBean
          [java] java.lang.IllegalAccessError: try to access method com.dev1.sysmex.fse.ejb.entity.fse.groupeItem.params.ParamItem.()V from class com.dev1.sysmex.fse.ejb.entity.fse.groupeItem.params.ParamGroupeItemBean
          [java] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
          [java] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
          [java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
          [java] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker_Stub.invokeHome(Unknown Source)
          [java] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:258)
          [java] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:182)
          [java] at $Proxy0.create(Unknown Source)
          [java] at com.dev1.sysmex.fse.ejb.entity.fse.groupeItem.params.test.ClientTest.main(ClientTest.java:42)

          ERIC PAPET
          DEV1.0
          best regard's