We're developing an application with Castor and JBoss. Since upgrading to
JBoss 2.4.4, we get the error "LockNotGrantedException:
persist.writeLockTimeout" in the ejbStore method of our user bean. This only
happens when creating a new user, we can read and modify existing users
without problem. The mapping of the DOs involved is given below. Our guess
is that this has something to do with the dependent UserRightDO or
CustomizationDO.  UserDO maintains an ArrayList with instances of these to
classes. Note however that both lists are empty when the error occurs.

Any ideas how to track this down?

    Thanks, Sven....

The creation of a User is done like this:

    public String ejbCreate(String login) throws CreateException {
        try {
            Database db = jdo.getDatabase();
            data = new UserDO(); // Initializes empty collections for rights
and customizations
            System.out.println("creating UserDO");
            db.create(data);
            db.close();
        } catch(DuplicateIdentityException e) {
            ...
        } catch(Exception e) {
            e.printStackTrace();
            throw new EJBException(e);
        }
        dirty = true;
        return login;
    }

The offending ejbStore method:

    public void ejbStore() {
        try {
            Database db = jdo.getDatabase();
            if (!db.isPersistent(data)) {
                db.update(data); // <-- Exception!
            }
            db.close();
        } catch(Exception e) {
            e.printStackTrace();
            throw new EJBException(e);
        }
        dirty = false;
    }


excerpt from mapping

  <class name="de.imost.user.ejb.UserDO" access="shared" identity="login">
    <map-to table="Users" />
    <cache-type type="unlimited" />
    <field name="login" type="string" required="true">
      <sql type="varchar" name="login" />
      <bind-xml name="login" />
    </field>
    <field name="password" type="string">
      <sql type="varchar" name="password" />
      <bind-xml name="password" />
    </field>
    <field name="rights" collection="arraylist"
type="de.imost.user.ejb.UserRightDO">
      <sql many-key="login" />
      <bind-xml name="rights" />
    </field>
    <field name="customizations" collection="arraylist"
type="de.imost.user.ejb.CustomizationDO">
      <sql many-key="login" />
      <bind-xml name="customizations" />
    </field>
    <field name="contactId" type="integer">
      <sql type="integer" name="contactId" />
      <bind-xml name="contactId" />
    </field>
  </class>
  <class name="de.imost.user.ejb.UserRightDO" key-generator="MAX"
depends="de.imost.user.ejb.UserDO" access="shared" identity="id">
    <map-to table="User_Rights" />
    <cache-type type="unlimited" />
    <field name="id" type="integer">
      <sql type="integer" name="id" />
      <bind-xml name="id" />
    </field>
    <field name="user" type="de.imost.user.ejb.UserDO" required="true">
      <sql name="login" />
      <bind-xml name="user" />
    </field>
    <field name="name" type="string" required="true">
      <sql type="varchar" name="name" />
      <bind-xml name="name" />
    </field>
    <field name="value" type="boolean" required="true">
      <sql type="char" name="value" />
      <bind-xml name="value" />
    </field>
  </class>
  <class name="de.imost.user.ejb.CustomizationDO" key-generator="MAX"
depends="de.imost.user.ejb.UserDO" access="shared" identity="id">
    <map-to table="User_Customizations" />
    <cache-type type="unlimited" />
    <field name="id" type="integer">
      <sql type="integer" name="id" />
      <bind-xml name="id" />
    </field>
    <field name="user" type="de.imost.user.ejb.UserDO" required="true">
      <sql name="login" />
      <bind-xml name="user" />
    </field>
    <field name="name" type="string" required="true">
      <sql type="varchar" name="name" />
      <bind-xml name="name" />
    </field>
    <field name="value" type="string" required="true">
      <sql type="varchar" name="value" />
      <bind-xml name="value" />
    </field>
  </class>

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to