4 Replies Latest reply on Mar 14, 2003 5:02 AM by benholland

    illegal state

    benholland

      Hi,
      I have speant all day on this and would really appreciate a push in the right direction.

      When I try and access a cmp entity's attribute with a get then jboss gives.

      2003-03-13 14:53:39,619 ERROR [org.jboss.ejb.plugins.LogInterceptor] RuntimeException:
      java.lang.IllegalStateException: removing bean lock and it has tx set!

      I have checked my primary key and it looks ok.

      the ejb jar is:

      <ejb-jar>

      <enterprise-beans>



      <ejb-name>Customer</ejb-name>

      mvdc.ejb.account.CustomerHome

      mvdc.ejb.account.Customer

      <ejb-class>mvdc.ejb.account.CustomerBean</ejb-class>

      <persistence-type>Container</persistence-type>

      <prim-key-class>mvdc.ejb.account.CustomerPK</prim-key-class>

      False

      <cmp-version>2.x</cmp-version>

      <abstract-schema-name>CustomerBean</abstract-schema-name>

      <cmp-field>

      <field-name>CustomerID</field-name>

      </cmp-field>

      <cmp-field>

      <field-name>name</field-name>

      </cmp-field>

      <cmp-field>

      <field-name>PassWord</field-name>

      </cmp-field>



      </enterprise-beans>
      <assembly-descriptor>
      <container-transaction>

      <ejb-name>Customer</ejb-name>
      <method-intf>Remote</method-intf>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>

        • 1. Re: illegal state
          ddurst1

          Well I have read numerous posts on this topic and I have experienced it every once and a while.
          Here is my suggestion from what I have read (BTW I am not a expert).

          Check your setEntityContext, make sure you are actually setting your contained EntityContext such as the following:

          public void setEntityContext(EntityContext ctx) { this.ctx = ctx; }

          • 2. Re: illegal state
            benholland

            mmmmmmmmm, no checked that.

            • 3. Re: illegal state
              benholland

              i noticed that the entity context is being set twice?

              09:54:28,936 INFO [STDOUT] setEntityContext called
              09:54:32,655 INFO [STDOUT] setEntityContext called
              09:54:32,655 INFO [STDOUT] ejbActivate() called.
              09:54:33,092 INFO [STDOUT] ejbLoad() called.
              09:54:33,170 ERROR [BeanLock] removing bean lock and

              has anyone seen this before??

              • 4. Re: illegal state
                benholland

                I am calling the CMP bean from a remote client.
                I get the above error if I have the transaction attribute
                of the assembly descriptor set Required of Requires new.
                If I start a user transaction from the remote client it still fails with the above error.

                Required fails
                Requires New fails
                Supports succeeds.