4 Replies Latest reply on Jun 25, 2003 12:59 AM by saddysan

    java.lang.IllegalStateException: removing bean lock and it h

    saddysan

      Following is the stack trace of the error which i recieve whenever i call business method of my BMP. can any body help me?

      java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      java.rmi.ServerException: removing bean lock and it has tx set!; nested exception is:
      java.lang.IllegalStateException: removing bean lock and it has tx set!
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:248)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:136)
      at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:128)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:73)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76)
      at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:116)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy1.deposit(Unknown Source)
      at Client.main(Client.java:43)
      Caused by: java.rmi.ServerException: removing bean lock and it has tx set!; nested exception is:
      java.lang.IllegalStateException: removing bean lock and it has tx set!
      ... 12 more
      Caused by: java.lang.IllegalStateException: removing bean lock and it has tx set!
      ... 12 more
      Normal Termination

        • 1. Re: java.lang.IllegalStateException: removing bean lock and

          The most likely cause of this problem is that
          you a bad primary key implementation

          hashCode, equals or serialization.

          Regards,
          Adrian

          • 2. Re: java.lang.IllegalStateException: removing bean lock and
            saddysan

            I think u r right, even at the time of deployment serevr warned about this(that there is no proper implementation of hashCode and equals method)

            but however i think i have implemented these methods correctly, may be u can help ime n finding the error. here is the code for my Primary Key class

            package account;

            import java.io.Serializable;

            /**
            * Primary Key class for Account.
            */
            public class AccountPK extends Object implements java.io.Serializable {
            public String accountID;

            public AccountPK(String id) {
            this.accountID = id;
            }

            public AccountPK() {
            }

            public String toString() {
            return accountID;
            }

            public int hashCode()
            {
            return super.hashCode();
            }

            public boolean equals(Object obj)
            {
            return super.equals(obj);
            }
            }

            • 3. Re: java.lang.IllegalStateException: removing bean lock and

              No that is not correct.

              public int hashCode()
              {
              return id.hashCode();
              }

              public boolean equals(Object obj)
              {
              if (obj == this) return true; // quick check
              if (obj == null) return false; // null is never equal
              if ((obj instanceof AccountPK) return false); // wrong type
              AccountPK other = (AccountPK) obj;
              return obj.id.equals(other.id); // Check the ids
              }

              You want to primary keys to be the same if they
              have the same id, not if they are the same
              object instance which has how "super"
              (java.lang.Object) implements them.

              Regards,
              Adrian

              • 4. Re: java.lang.IllegalStateException: removing bean lock and
                saddysan

                thanx,
                its working now