You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Tino Schöllhorn <t....@plattform-gmbh.de> on 2004/11/19 11:51:02 UTC
ConcurrentModificationException while Deleting Objects
Hi,
I have a weird problem. We are using OJB 1.0 and are greatly satisfied.
Now we stumbled across a strange problem. When deleting a Person-Object
with:
Person p = ...;
pb.beginTransaction();
pb.delete(p);
pb.commitTransaction();
we get (sometimes) the following Exception:
java.util.ConcurrentModificationException
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:
448)
java.util.AbstractList$Itr.next(AbstractList.java: 419)
org.apache.ojb.broker.core.PersistenceBrokerImpl.deleteCollections(null:
no source available)
org.apache.ojb.broker.core.PersistenceBrokerImpl.doDelete(null: no
source available)
org.apache.ojb.broker.core.PersistenceBrokerImpl.delete(null: no
source available)
org.apache.ojb.broker.core.DelegatingPersistenceBroker.delete(null: no
source available)
org.apache.ojb.broker.core.DelegatingPersistenceBroker.delete(null: no
source available)
kos.generator.DataObject.delete(DataObject.java: 106)
kos.wnetz.modules.editor.DAOEditorModule.deleteIt(DAOEditorModule.java: 403)
sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:
no source available)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
java.lang.reflect.Method.invoke(Method.java: 324)
kos.wnetz.system.Action.invoke(Action.java: 164)
kos.wnetz.system.Action$1.call(Action.java: 213)
EDU.oswego.cs.dl.util.concurrent.FutureResult$1.run(null: no source
available)
java.lang.Thread.run(Thread.java: 534)
-------------- END Stacktrace
The thing is: I am absolutely sure that we do not modify the object when
deleting it. Do you have any idea what I can do about it? Should I
switch to OJB 1.0.1?
I am glad for any help.
Tino
P.S.: The configuration for the Person-Object is the following (it is
quite long, sorry about that ;-)):
<class-descriptor class="kos.intranet2.om.Person" table="Person">
<field-descriptor name="id" column="PE_ID" jdbc-type="INTEGER"
primarykey="true" autoincrement="true" access="readonly"/>
<field-descriptor name="userId" column="PE_User" jdbc-type="INTEGER"/>
<field-descriptor name="title" column="PE_Title" jdbc-type="VARCHAR"/>
<field-descriptor name="firstname" column="PE_Firstname"
jdbc-type="VARCHAR"/>
<field-descriptor name="lastname" column="PE_Lastname"
jdbc-type="VARCHAR"/>
<field-descriptor name="fullName" column="PE_FullName"
jdbc-type="VARCHAR"/>
<field-descriptor name="initials" column="PE_Initials"
jdbc-type="VARCHAR"/>
<field-descriptor name="description" column="PE_Description"
jdbc-type="LONGVARCHAR"/>
<field-descriptor name="gender" column="PE_Gender" jdbc-type="BIT"/>
<field-descriptor name="birthday" column="PE_Birthday" jdbc-type="DATE"/>
<field-descriptor name="country" column="PE_Country" jdbc-type="VARCHAR"/>
<field-descriptor name="pictureId" column="PE_Picture"
jdbc-type="INTEGER"/>
<field-descriptor name="typeId" column="PE_Type" jdbc-type="INTEGER"
access="anonymous"/>
<field-descriptor name="privateData" column="PE_Private" jdbc-type="BIT"/>
<field-descriptor name="owner" column="PE_Owner" jdbc-type="INTEGER"/>
<field-descriptor name="creationDate" column="PE_CreationDate"
jdbc-type="TIMESTAMP"/>
<field-descriptor name="archiveDate" column="PE_ArchiveDate"
jdbc-type="TIMESTAMP"/>
<!-- 1: N - Relation: 1er Seite Type -->
<reference-descriptor
name="type"
class-ref="kos.intranet2.om.PersonType"
auto-retrieve="true"
auto-update="link"
auto-delete="none">
<foreignkey field-ref="typeId"/>
<attribute attribute-name="reverseCollection"
attribute-value="persons"/>
</reference-descriptor>
<!-- M:N - Relation Person-Addresses -->
<collection-descriptor
name="addresses"
collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
element-class-ref="kos.intranet2.om.Address"
auto-retrieve="true"
auto-update="link"
auto-delete="link"
proxy="true"
indirection-table="Person_Address">
<fk-pointing-to-this-class column="PEAD_Person"/>
<fk-pointing-to-element-class column="PEAD_Address"/>
<attribute attribute-name="reverseCollection" attribute-value="persons"/>
</collection-descriptor>
<!-- Company-Persons-->
<collection-descriptor
name="companyPersons"
collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
element-class-ref="kos.intranet2.om.CompanyPerson"
auto-retrieve="true"
auto-update="object"
auto-delete="object"
proxy="true">
<inverse-foreignkey field-ref="personId"/>
<attribute attribute-name="reverseReference" attribute-value="person"/>
</collection-descriptor>
<!-- TeamPerson -->
<collection-descriptor
name="teamPersons"
collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
element-class-ref="kos.intranet2.om.TeamPerson"
auto-retrieve="true"
auto-update="object"
auto-delete="object"
proxy="true">
<inverse-foreignkey field-ref="personId"/>
<attribute attribute-name="reverseReference" attribute-value="person"/>
</collection-descriptor>
<!-- ProjectPerson -->
<collection-descriptor
name="projectPersons"
collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
element-class-ref="kos.intranet2.om.ProjectPerson"
auto-retrieve="true"
auto-update="object"
auto-delete="object"
proxy="true">
<inverse-foreignkey field-ref="personId"/>
<attribute attribute-name="reverseReference" attribute-value="person"/>
</collection-descriptor>
<!-- M:N Relation Person-Appointment -->
<collection-descriptor
name="appointments"
collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
element-class-ref="kos.intranet2.om.Appointment"
auto-retrieve="true"
auto-update="link"
auto-delete="link"
proxy="true"
indirection-table="Person_Appointment">
<fk-pointing-to-this-class column="PEAP_Person"/>
<fk-pointing-to-element-class column="PEAP_Appointment"/>
<attribute attribute-name="reverseCollection" attribute-value="persons"/>
</collection-descriptor>
<!-- M:N Relation Person-Task -->
<collection-descriptor
name="tasks"
collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
element-class-ref="kos.intranet2.om.Task"
auto-retrieve="true"
auto-update="link"
auto-delete="link"
proxy="true"
indirection-table="Person_Task">
<fk-pointing-to-this-class column="PETA_Person"/>
<fk-pointing-to-element-class column="PETA_Task"/>
<attribute attribute-name="reverseCollection" attribute-value="persons"/>
</collection-descriptor>
</class-descriptor>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: ConcurrentModificationException while Deleting Objects
Posted by Gerhard Grosse <ge...@lex-com.net>.
Hi Tinoe
On Fri, 19 Nov 2004 13:49:59 +0100, Tino Schöllhorn
<t....@plattform-gmbh.de> wrote:
>Hi Gerhard,
>
>our application is single-threaded. With the concurrent-package we are
>ensuring that requests are delivered in a defined time-frame, or else
>they are dismissed. So I do not know which other Thread should modify
>the Person object. But do you know how I could get the name of the
>collection which cannot be iterated?
Other than using a debugger (and the source distribution of OJB) not easily, I'm
afraid. Maybe by putting log statements in the getter methods of the various
collecions in the person object. The last logged collection would be the one
that causes the error. This works only if you are not using DirectFieldAccess,
of course.
If this really happens in a single thread, I could only imagine some kind of
recursion causing this. Maybe your object model has some hidden cycles?
Gerhard
>
>Tino
>
>Gerhard Grosse wrote:
>
>> Hi Tino
>>
>> this looks like a multi-threading problem. java.util.ConcurrentModification
>> exception is thrown by the Java runtime when a List is being modified while an
>> iterator is iterating over it. The list in this case is one of the collections
>> in your Person object. Is it possible that a second thread is working on the
>> same Person? Also the bottom of your stack trace
>>
>>
>>>EDU.oswego.cs.dl.util.concurrent.FutureResult$1.run(null: no source
>>>available)
>>>java.lang.Thread.run(Thread.java: 534)
>>
>>
>> points into this direction.
>>
>> Gerhard
>>
>> On Fri, 19 Nov 2004 11:51:02 +0100, Tino Schöllhorn
>> <t....@plattform-gmbh.de> wrote:
>>
>>
>>>Hi,
>>>
>>>I have a weird problem. We are using OJB 1.0 and are greatly satisfied.
>>>Now we stumbled across a strange problem. When deleting a Person-Object
>>>with:
>>>
>>>Person p = ...;
>>>pb.beginTransaction();
>>>pb.delete(p);
>>>pb.commitTransaction();
>>>
>>>we get (sometimes) the following Exception:
>>>
>>>java.util.ConcurrentModificationException
>>>java.util.AbstractList$Itr.checkForComodification(AbstractList.java:
>>>448)
>>>java.util.AbstractList$Itr.next(AbstractList.java: 419)
>>>org.apache.ojb.broker.core.PersistenceBrokerImpl.deleteCollections(null:
>>>no source available)
>>>org.apache.ojb.broker.core.PersistenceBrokerImpl.doDelete(null: no
>>>source available)
>>>org.apache.ojb.broker.core.PersistenceBrokerImpl.delete(null: no
>>>source available)
>>>org.apache.ojb.broker.core.DelegatingPersistenceBroker.delete(null: no
>>>source available)
>>>org.apache.ojb.broker.core.DelegatingPersistenceBroker.delete(null: no
>>>source available)
>>>kos.generator.DataObject.delete(DataObject.java: 106)
>>>kos.wnetz.modules.editor.DAOEditorModule.deleteIt(DAOEditorModule.java: 403)
>>>
>>>sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:
>>>no source available)
>>>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>>>39)
>>>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
>>>25)
>>>java.lang.reflect.Method.invoke(Method.java: 324)
>>>kos.wnetz.system.Action.invoke(Action.java: 164)
>>>kos.wnetz.system.Action$1.call(Action.java: 213)
>>>EDU.oswego.cs.dl.util.concurrent.FutureResult$1.run(null: no source
>>>available)
>>>java.lang.Thread.run(Thread.java: 534)
>>>
>>>-------------- END Stacktrace
>>>
>>>The thing is: I am absolutely sure that we do not modify the object when
>>>deleting it. Do you have any idea what I can do about it? Should I
>>>switch to OJB 1.0.1?
>>>
>>>I am glad for any help.
>>>
>>>Tino
>>>
>>>P.S.: The configuration for the Person-Object is the following (it is
>>>quite long, sorry about that ;-)):
>>>
>>><class-descriptor class="kos.intranet2.om.Person" table="Person">
>>> <field-descriptor name="id" column="PE_ID" jdbc-type="INTEGER"
>>> primarykey="true" autoincrement="true" access="readonly"/>
>>>
>>> <field-descriptor name="userId" column="PE_User" jdbc-type="INTEGER"/>
>>> <field-descriptor name="title" column="PE_Title" jdbc-type="VARCHAR"/>
>>> <field-descriptor name="firstname" column="PE_Firstname"
>>>jdbc-type="VARCHAR"/>
>>> <field-descriptor name="lastname" column="PE_Lastname"
>>>jdbc-type="VARCHAR"/>
>>> <field-descriptor name="fullName" column="PE_FullName"
>>>jdbc-type="VARCHAR"/>
>>> <field-descriptor name="initials" column="PE_Initials"
>>>jdbc-type="VARCHAR"/>
>>> <field-descriptor name="description" column="PE_Description"
>>>jdbc-type="LONGVARCHAR"/>
>>> <field-descriptor name="gender" column="PE_Gender" jdbc-type="BIT"/>
>>> <field-descriptor name="birthday" column="PE_Birthday" jdbc-type="DATE"/>
>>> <field-descriptor name="country" column="PE_Country" jdbc-type="VARCHAR"/>
>>> <field-descriptor name="pictureId" column="PE_Picture"
>>>jdbc-type="INTEGER"/>
>>> <field-descriptor name="typeId" column="PE_Type" jdbc-type="INTEGER"
>>>access="anonymous"/>
>>> <field-descriptor name="privateData" column="PE_Private" jdbc-type="BIT"/>
>>> <field-descriptor name="owner" column="PE_Owner" jdbc-type="INTEGER"/>
>>>
>>> <field-descriptor name="creationDate" column="PE_CreationDate"
>>>jdbc-type="TIMESTAMP"/>
>>> <field-descriptor name="archiveDate" column="PE_ArchiveDate"
>>>jdbc-type="TIMESTAMP"/>
>>>
>>> <!-- 1: N - Relation: 1er Seite Type -->
>>> <reference-descriptor
>>> name="type"
>>> class-ref="kos.intranet2.om.PersonType"
>>> auto-retrieve="true"
>>> auto-update="link"
>>> auto-delete="none">
>>> <foreignkey field-ref="typeId"/>
>>> <attribute attribute-name="reverseCollection"
>>>attribute-value="persons"/>
>>> </reference-descriptor>
>>>
>>> <!-- M:N - Relation Person-Addresses -->
>>> <collection-descriptor
>>> name="addresses"
>>>
>>>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>>> element-class-ref="kos.intranet2.om.Address"
>>> auto-retrieve="true"
>>> auto-update="link"
>>> auto-delete="link"
>>> proxy="true"
>>> indirection-table="Person_Address">
>>>
>>> <fk-pointing-to-this-class column="PEAD_Person"/>
>>> <fk-pointing-to-element-class column="PEAD_Address"/>
>>>
>>> <attribute attribute-name="reverseCollection" attribute-value="persons"/>
>>> </collection-descriptor>
>>>
>>> <!-- Company-Persons-->
>>> <collection-descriptor
>>> name="companyPersons"
>>>
>>>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>>> element-class-ref="kos.intranet2.om.CompanyPerson"
>>> auto-retrieve="true"
>>> auto-update="object"
>>> auto-delete="object"
>>> proxy="true">
>>>
>>> <inverse-foreignkey field-ref="personId"/>
>>> <attribute attribute-name="reverseReference" attribute-value="person"/>
>>> </collection-descriptor>
>>>
>>>
>>> <!-- TeamPerson -->
>>> <collection-descriptor
>>> name="teamPersons"
>>>
>>>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>>> element-class-ref="kos.intranet2.om.TeamPerson"
>>> auto-retrieve="true"
>>> auto-update="object"
>>> auto-delete="object"
>>> proxy="true">
>>>
>>> <inverse-foreignkey field-ref="personId"/>
>>> <attribute attribute-name="reverseReference" attribute-value="person"/>
>>> </collection-descriptor>
>>>
>>>
>>> <!-- ProjectPerson -->
>>> <collection-descriptor
>>> name="projectPersons"
>>>
>>>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>>> element-class-ref="kos.intranet2.om.ProjectPerson"
>>> auto-retrieve="true"
>>> auto-update="object"
>>> auto-delete="object"
>>> proxy="true">
>>>
>>> <inverse-foreignkey field-ref="personId"/>
>>> <attribute attribute-name="reverseReference" attribute-value="person"/>
>>> </collection-descriptor>
>>>
>>> <!-- M:N Relation Person-Appointment -->
>>> <collection-descriptor
>>> name="appointments"
>>>
>>>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>>> element-class-ref="kos.intranet2.om.Appointment"
>>> auto-retrieve="true"
>>> auto-update="link"
>>> auto-delete="link"
>>> proxy="true"
>>> indirection-table="Person_Appointment">
>>>
>>> <fk-pointing-to-this-class column="PEAP_Person"/>
>>> <fk-pointing-to-element-class column="PEAP_Appointment"/>
>>>
>>> <attribute attribute-name="reverseCollection" attribute-value="persons"/>
>>> </collection-descriptor>
>>>
>>> <!-- M:N Relation Person-Task -->
>>> <collection-descriptor
>>> name="tasks"
>>>
>>>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>>> element-class-ref="kos.intranet2.om.Task"
>>> auto-retrieve="true"
>>> auto-update="link"
>>> auto-delete="link"
>>> proxy="true"
>>> indirection-table="Person_Task">
>>>
>>> <fk-pointing-to-this-class column="PETA_Person"/>
>>> <fk-pointing-to-element-class column="PETA_Task"/>
>>>
>>> <attribute attribute-name="reverseCollection" attribute-value="persons"/>
>>> </collection-descriptor>
>>></class-descriptor>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: ConcurrentModificationException while Deleting Objects
Posted by Tino Schöllhorn <t....@plattform-gmbh.de>.
Hi Gerhard,
our application is single-threaded. With the concurrent-package we are
ensuring that requests are delivered in a defined time-frame, or else
they are dismissed. So I do not know which other Thread should modify
the Person object. But do you know how I could get the name of the
collection which cannot be iterated?
Tino
Gerhard Grosse wrote:
> Hi Tino
>
> this looks like a multi-threading problem. java.util.ConcurrentModification
> exception is thrown by the Java runtime when a List is being modified while an
> iterator is iterating over it. The list in this case is one of the collections
> in your Person object. Is it possible that a second thread is working on the
> same Person? Also the bottom of your stack trace
>
>
>>EDU.oswego.cs.dl.util.concurrent.FutureResult$1.run(null: no source
>>available)
>>java.lang.Thread.run(Thread.java: 534)
>
>
> points into this direction.
>
> Gerhard
>
> On Fri, 19 Nov 2004 11:51:02 +0100, Tino Schöllhorn
> <t....@plattform-gmbh.de> wrote:
>
>
>>Hi,
>>
>>I have a weird problem. We are using OJB 1.0 and are greatly satisfied.
>>Now we stumbled across a strange problem. When deleting a Person-Object
>>with:
>>
>>Person p = ...;
>>pb.beginTransaction();
>>pb.delete(p);
>>pb.commitTransaction();
>>
>>we get (sometimes) the following Exception:
>>
>>java.util.ConcurrentModificationException
>>java.util.AbstractList$Itr.checkForComodification(AbstractList.java:
>>448)
>>java.util.AbstractList$Itr.next(AbstractList.java: 419)
>>org.apache.ojb.broker.core.PersistenceBrokerImpl.deleteCollections(null:
>>no source available)
>>org.apache.ojb.broker.core.PersistenceBrokerImpl.doDelete(null: no
>>source available)
>>org.apache.ojb.broker.core.PersistenceBrokerImpl.delete(null: no
>>source available)
>>org.apache.ojb.broker.core.DelegatingPersistenceBroker.delete(null: no
>>source available)
>>org.apache.ojb.broker.core.DelegatingPersistenceBroker.delete(null: no
>>source available)
>>kos.generator.DataObject.delete(DataObject.java: 106)
>>kos.wnetz.modules.editor.DAOEditorModule.deleteIt(DAOEditorModule.java: 403)
>>
>>sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:
>>no source available)
>>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>>39)
>>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
>>25)
>>java.lang.reflect.Method.invoke(Method.java: 324)
>>kos.wnetz.system.Action.invoke(Action.java: 164)
>>kos.wnetz.system.Action$1.call(Action.java: 213)
>>EDU.oswego.cs.dl.util.concurrent.FutureResult$1.run(null: no source
>>available)
>>java.lang.Thread.run(Thread.java: 534)
>>
>>-------------- END Stacktrace
>>
>>The thing is: I am absolutely sure that we do not modify the object when
>>deleting it. Do you have any idea what I can do about it? Should I
>>switch to OJB 1.0.1?
>>
>>I am glad for any help.
>>
>>Tino
>>
>>P.S.: The configuration for the Person-Object is the following (it is
>>quite long, sorry about that ;-)):
>>
>><class-descriptor class="kos.intranet2.om.Person" table="Person">
>> <field-descriptor name="id" column="PE_ID" jdbc-type="INTEGER"
>> primarykey="true" autoincrement="true" access="readonly"/>
>>
>> <field-descriptor name="userId" column="PE_User" jdbc-type="INTEGER"/>
>> <field-descriptor name="title" column="PE_Title" jdbc-type="VARCHAR"/>
>> <field-descriptor name="firstname" column="PE_Firstname"
>>jdbc-type="VARCHAR"/>
>> <field-descriptor name="lastname" column="PE_Lastname"
>>jdbc-type="VARCHAR"/>
>> <field-descriptor name="fullName" column="PE_FullName"
>>jdbc-type="VARCHAR"/>
>> <field-descriptor name="initials" column="PE_Initials"
>>jdbc-type="VARCHAR"/>
>> <field-descriptor name="description" column="PE_Description"
>>jdbc-type="LONGVARCHAR"/>
>> <field-descriptor name="gender" column="PE_Gender" jdbc-type="BIT"/>
>> <field-descriptor name="birthday" column="PE_Birthday" jdbc-type="DATE"/>
>> <field-descriptor name="country" column="PE_Country" jdbc-type="VARCHAR"/>
>> <field-descriptor name="pictureId" column="PE_Picture"
>>jdbc-type="INTEGER"/>
>> <field-descriptor name="typeId" column="PE_Type" jdbc-type="INTEGER"
>>access="anonymous"/>
>> <field-descriptor name="privateData" column="PE_Private" jdbc-type="BIT"/>
>> <field-descriptor name="owner" column="PE_Owner" jdbc-type="INTEGER"/>
>>
>> <field-descriptor name="creationDate" column="PE_CreationDate"
>>jdbc-type="TIMESTAMP"/>
>> <field-descriptor name="archiveDate" column="PE_ArchiveDate"
>>jdbc-type="TIMESTAMP"/>
>>
>> <!-- 1: N - Relation: 1er Seite Type -->
>> <reference-descriptor
>> name="type"
>> class-ref="kos.intranet2.om.PersonType"
>> auto-retrieve="true"
>> auto-update="link"
>> auto-delete="none">
>> <foreignkey field-ref="typeId"/>
>> <attribute attribute-name="reverseCollection"
>>attribute-value="persons"/>
>> </reference-descriptor>
>>
>> <!-- M:N - Relation Person-Addresses -->
>> <collection-descriptor
>> name="addresses"
>>
>>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>> element-class-ref="kos.intranet2.om.Address"
>> auto-retrieve="true"
>> auto-update="link"
>> auto-delete="link"
>> proxy="true"
>> indirection-table="Person_Address">
>>
>> <fk-pointing-to-this-class column="PEAD_Person"/>
>> <fk-pointing-to-element-class column="PEAD_Address"/>
>>
>> <attribute attribute-name="reverseCollection" attribute-value="persons"/>
>> </collection-descriptor>
>>
>> <!-- Company-Persons-->
>> <collection-descriptor
>> name="companyPersons"
>>
>>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>> element-class-ref="kos.intranet2.om.CompanyPerson"
>> auto-retrieve="true"
>> auto-update="object"
>> auto-delete="object"
>> proxy="true">
>>
>> <inverse-foreignkey field-ref="personId"/>
>> <attribute attribute-name="reverseReference" attribute-value="person"/>
>> </collection-descriptor>
>>
>>
>> <!-- TeamPerson -->
>> <collection-descriptor
>> name="teamPersons"
>>
>>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>> element-class-ref="kos.intranet2.om.TeamPerson"
>> auto-retrieve="true"
>> auto-update="object"
>> auto-delete="object"
>> proxy="true">
>>
>> <inverse-foreignkey field-ref="personId"/>
>> <attribute attribute-name="reverseReference" attribute-value="person"/>
>> </collection-descriptor>
>>
>>
>> <!-- ProjectPerson -->
>> <collection-descriptor
>> name="projectPersons"
>>
>>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>> element-class-ref="kos.intranet2.om.ProjectPerson"
>> auto-retrieve="true"
>> auto-update="object"
>> auto-delete="object"
>> proxy="true">
>>
>> <inverse-foreignkey field-ref="personId"/>
>> <attribute attribute-name="reverseReference" attribute-value="person"/>
>> </collection-descriptor>
>>
>> <!-- M:N Relation Person-Appointment -->
>> <collection-descriptor
>> name="appointments"
>>
>>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>> element-class-ref="kos.intranet2.om.Appointment"
>> auto-retrieve="true"
>> auto-update="link"
>> auto-delete="link"
>> proxy="true"
>> indirection-table="Person_Appointment">
>>
>> <fk-pointing-to-this-class column="PEAP_Person"/>
>> <fk-pointing-to-element-class column="PEAP_Appointment"/>
>>
>> <attribute attribute-name="reverseCollection" attribute-value="persons"/>
>> </collection-descriptor>
>>
>> <!-- M:N Relation Person-Task -->
>> <collection-descriptor
>> name="tasks"
>>
>>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
>> element-class-ref="kos.intranet2.om.Task"
>> auto-retrieve="true"
>> auto-update="link"
>> auto-delete="link"
>> proxy="true"
>> indirection-table="Person_Task">
>>
>> <fk-pointing-to-this-class column="PETA_Person"/>
>> <fk-pointing-to-element-class column="PETA_Task"/>
>>
>> <attribute attribute-name="reverseCollection" attribute-value="persons"/>
>> </collection-descriptor>
>></class-descriptor>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: ConcurrentModificationException while Deleting Objects
Posted by Gerhard Grosse <ge...@lex-com.net>.
Hi Tino
this looks like a multi-threading problem. java.util.ConcurrentModification
exception is thrown by the Java runtime when a List is being modified while an
iterator is iterating over it. The list in this case is one of the collections
in your Person object. Is it possible that a second thread is working on the
same Person? Also the bottom of your stack trace
>EDU.oswego.cs.dl.util.concurrent.FutureResult$1.run(null: no source
>available)
>java.lang.Thread.run(Thread.java: 534)
points into this direction.
Gerhard
On Fri, 19 Nov 2004 11:51:02 +0100, Tino Schöllhorn
<t....@plattform-gmbh.de> wrote:
>Hi,
>
>I have a weird problem. We are using OJB 1.0 and are greatly satisfied.
>Now we stumbled across a strange problem. When deleting a Person-Object
>with:
>
>Person p = ...;
>pb.beginTransaction();
>pb.delete(p);
>pb.commitTransaction();
>
>we get (sometimes) the following Exception:
>
>java.util.ConcurrentModificationException
>java.util.AbstractList$Itr.checkForComodification(AbstractList.java:
>448)
>java.util.AbstractList$Itr.next(AbstractList.java: 419)
>org.apache.ojb.broker.core.PersistenceBrokerImpl.deleteCollections(null:
>no source available)
>org.apache.ojb.broker.core.PersistenceBrokerImpl.doDelete(null: no
>source available)
>org.apache.ojb.broker.core.PersistenceBrokerImpl.delete(null: no
>source available)
>org.apache.ojb.broker.core.DelegatingPersistenceBroker.delete(null: no
>source available)
>org.apache.ojb.broker.core.DelegatingPersistenceBroker.delete(null: no
>source available)
>kos.generator.DataObject.delete(DataObject.java: 106)
>kos.wnetz.modules.editor.DAOEditorModule.deleteIt(DAOEditorModule.java: 403)
>
>sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:
>no source available)
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>39)
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
>25)
>java.lang.reflect.Method.invoke(Method.java: 324)
>kos.wnetz.system.Action.invoke(Action.java: 164)
>kos.wnetz.system.Action$1.call(Action.java: 213)
>EDU.oswego.cs.dl.util.concurrent.FutureResult$1.run(null: no source
>available)
>java.lang.Thread.run(Thread.java: 534)
>
>-------------- END Stacktrace
>
>The thing is: I am absolutely sure that we do not modify the object when
>deleting it. Do you have any idea what I can do about it? Should I
>switch to OJB 1.0.1?
>
>I am glad for any help.
>
>Tino
>
>P.S.: The configuration for the Person-Object is the following (it is
>quite long, sorry about that ;-)):
>
><class-descriptor class="kos.intranet2.om.Person" table="Person">
> <field-descriptor name="id" column="PE_ID" jdbc-type="INTEGER"
> primarykey="true" autoincrement="true" access="readonly"/>
>
> <field-descriptor name="userId" column="PE_User" jdbc-type="INTEGER"/>
> <field-descriptor name="title" column="PE_Title" jdbc-type="VARCHAR"/>
> <field-descriptor name="firstname" column="PE_Firstname"
>jdbc-type="VARCHAR"/>
> <field-descriptor name="lastname" column="PE_Lastname"
>jdbc-type="VARCHAR"/>
> <field-descriptor name="fullName" column="PE_FullName"
>jdbc-type="VARCHAR"/>
> <field-descriptor name="initials" column="PE_Initials"
>jdbc-type="VARCHAR"/>
> <field-descriptor name="description" column="PE_Description"
>jdbc-type="LONGVARCHAR"/>
> <field-descriptor name="gender" column="PE_Gender" jdbc-type="BIT"/>
> <field-descriptor name="birthday" column="PE_Birthday" jdbc-type="DATE"/>
> <field-descriptor name="country" column="PE_Country" jdbc-type="VARCHAR"/>
> <field-descriptor name="pictureId" column="PE_Picture"
>jdbc-type="INTEGER"/>
> <field-descriptor name="typeId" column="PE_Type" jdbc-type="INTEGER"
>access="anonymous"/>
> <field-descriptor name="privateData" column="PE_Private" jdbc-type="BIT"/>
> <field-descriptor name="owner" column="PE_Owner" jdbc-type="INTEGER"/>
>
> <field-descriptor name="creationDate" column="PE_CreationDate"
>jdbc-type="TIMESTAMP"/>
> <field-descriptor name="archiveDate" column="PE_ArchiveDate"
>jdbc-type="TIMESTAMP"/>
>
> <!-- 1: N - Relation: 1er Seite Type -->
> <reference-descriptor
> name="type"
> class-ref="kos.intranet2.om.PersonType"
> auto-retrieve="true"
> auto-update="link"
> auto-delete="none">
> <foreignkey field-ref="typeId"/>
> <attribute attribute-name="reverseCollection"
>attribute-value="persons"/>
> </reference-descriptor>
>
> <!-- M:N - Relation Person-Addresses -->
> <collection-descriptor
> name="addresses"
>
>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
> element-class-ref="kos.intranet2.om.Address"
> auto-retrieve="true"
> auto-update="link"
> auto-delete="link"
> proxy="true"
> indirection-table="Person_Address">
>
> <fk-pointing-to-this-class column="PEAD_Person"/>
> <fk-pointing-to-element-class column="PEAD_Address"/>
>
> <attribute attribute-name="reverseCollection" attribute-value="persons"/>
> </collection-descriptor>
>
> <!-- Company-Persons-->
> <collection-descriptor
> name="companyPersons"
>
>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
> element-class-ref="kos.intranet2.om.CompanyPerson"
> auto-retrieve="true"
> auto-update="object"
> auto-delete="object"
> proxy="true">
>
> <inverse-foreignkey field-ref="personId"/>
> <attribute attribute-name="reverseReference" attribute-value="person"/>
> </collection-descriptor>
>
>
> <!-- TeamPerson -->
> <collection-descriptor
> name="teamPersons"
>
>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
> element-class-ref="kos.intranet2.om.TeamPerson"
> auto-retrieve="true"
> auto-update="object"
> auto-delete="object"
> proxy="true">
>
> <inverse-foreignkey field-ref="personId"/>
> <attribute attribute-name="reverseReference" attribute-value="person"/>
> </collection-descriptor>
>
>
> <!-- ProjectPerson -->
> <collection-descriptor
> name="projectPersons"
>
>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
> element-class-ref="kos.intranet2.om.ProjectPerson"
> auto-retrieve="true"
> auto-update="object"
> auto-delete="object"
> proxy="true">
>
> <inverse-foreignkey field-ref="personId"/>
> <attribute attribute-name="reverseReference" attribute-value="person"/>
> </collection-descriptor>
>
> <!-- M:N Relation Person-Appointment -->
> <collection-descriptor
> name="appointments"
>
>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
> element-class-ref="kos.intranet2.om.Appointment"
> auto-retrieve="true"
> auto-update="link"
> auto-delete="link"
> proxy="true"
> indirection-table="Person_Appointment">
>
> <fk-pointing-to-this-class column="PEAP_Person"/>
> <fk-pointing-to-element-class column="PEAP_Appointment"/>
>
> <attribute attribute-name="reverseCollection" attribute-value="persons"/>
> </collection-descriptor>
>
> <!-- M:N Relation Person-Task -->
> <collection-descriptor
> name="tasks"
>
>collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
> element-class-ref="kos.intranet2.om.Task"
> auto-retrieve="true"
> auto-update="link"
> auto-delete="link"
> proxy="true"
> indirection-table="Person_Task">
>
> <fk-pointing-to-this-class column="PETA_Person"/>
> <fk-pointing-to-element-class column="PETA_Task"/>
>
> <attribute attribute-name="reverseCollection" attribute-value="persons"/>
> </collection-descriptor>
></class-descriptor>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org