ConcurrentModificationException in RequestContextImpl class

Am currently getting a ConcurrentModificationException thrown by the
notifyRequestCompletionListeners method of the RequestContextImpl
class.
The context is:
A JSP includes two JSP fragments, containing tiled views bound to
primary models and surrounded by jato:context tags, to
enable/disable the display of one or the other.
The observed behavior is as follow:
a) Despite a JSP fragment doesn't need to be displayed (i.e.
beging<>Display method returns false), the associated tiled view is
though instanciated.
How come childs are instantiated though not used ?
I thought JATO instanciates resources only when needed - or is it
maybe because the JSP fragments are statically bound - translation-
time includes ?.
b) While in notifyRequestCompletionListeners method of the
RequestContextImpl class, a requestComplete() triggers the
instantiation of a tiled view, which sets a primary model in its
constructor, which is added to the request context. This triggers
the ConcurrentModificationException. The exception happens when the
tiled view contains a HREF (commenting the HREF out in the
registerChildren method, hides the problem).
How is it that instances are created during the
notifyRequestComplitionListeners method, and why only when the tiled
view contains HREF ?

Jacquess--
I don' t have a lot of time right now, but some comments until I have more
time:
I am getting a ConcurrentModificationException thrown by the
notifyRequestCompletionListeners method.
The context is a JSP including two JSP fragments surrounded
by "content" tags and containing tiled views with HREF childs.
The observed behavior is as follow:
a) Although a JSP fragment is not displayed, i.e. begin<>Display
method returns false, the corresponding tiled view class is though
instantiated.The question is when is it instantiated? I would expect it to be
instantiated on the subsequent request back to the server, but not during
the response/rendering phase (when the content tag comes into play). The
built-in mapRequestParameters() logic is not smart enough to skip mapping
values for registered containers. You may be able to encode a value in the
page that indicates the non-displayed views and avoids registering them for
that request. To do this, would want to use the optional constructor for
the ViewBean that takes a RequestContext:
public class MyViewBean extends ViewBeanBase
public MyViewBean(RequestContext context)
super(PAGE_NAME);
registerChild("text1",TextField.class);
if (context.getRequest().getParameter(TILEDVIEW1_SHOWN)!=null)
registerChild("tiledView1",MyTiledView.class);
registerChild("text2",TextField.class);
Get the idea? This is just a thought, I haven't thought it through
completely. In the future, would could perhaps encode this information
transparently for you and take advantage if it during parameter mapping.
I thought JATO instantiates childs only when needed ?
Is it because the JSP fragments are translation time includes ?
b) While iterating over the request completion listeners in the
notifyRequestCompletionListeners method, a new completion listener is
added, causing the ConcurrentModificationException. The completion
listener, which is the primary model of a tiled view, is added when
registering a child that is a HREF bound to this primary model.
Commenting out the registration of the HREF child in the tiled view
hides the problem.Patient: "Doctor, my arm hurts when I do this."
Doctor: "So don't do that."
Are you saying the registration is happening automatically and unavoidably
as a result of some JATO behavior, or are you intentionally adding a
listener during notification?
Should not all required childs be instantiated before the
notifyRequestCompletionListeners method is called ?Generally, yes, though if your listener makes a getChild() call on a child
that wasn't previously instantiated, it would cause that child to be
created.
Why does a HREF trigger the instantiation of a model and not a static
text child for instance ?
For more information about JATO, including download information, pleasevisit:
http://developer.iplanet.com/tech/appserver/framework/index.jsp

Similar Messages

  • ConcurrentModificationException while running the deployed application

    Hi,
    I am using JDeveloper 11.1.2.0.0 and WebLogic Server Version: 10.3.5.0 with production environment.
    My application is based on Customized Dynamic Tab Shell where each task flow is loaded with its own transaction and also it is defined not to share data control.
    I use a Collection Object inside TabContext class, which will be accessed and consumed (including modifications) by all dynamic tab loaded taskflow.
    I use Customized FactoryClass for every BC4JDataControl to track the request and also to pass parameter to model layer AMs
    When i run the application in local, i didn't get any error. But when i check the deployed application, I am getting ConcurrentModificationException frequently as javascript dialog
    java.util.ConcurrentModificationException
    ADF_FACES-60097: For more information, please see the server's error log for
    an entry beginning with: ADF_FACES-60096:Server Exception during PPR, #181When i check the server error log, it didn't say anything about my classes.
    [2011-10-04T01:35:33.608-07:00] [MDA1-Server01] [ERROR] [] [oracle.adfinternal.view.faces.config.rich.RegistrationConfigurator] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 11d1def534ea1be0:-38985633:132c98ea02d:-8000-000000000000b88b,0] [APP: CalwinApplication] ADF_FACES-60096:Server Exception during PPR, #55[[
    java.util.ConcurrentModificationException
         at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
         at java.util.AbstractList$Itr.next(AbstractList.java:343)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:619)
         at oracle.adf.view.rich.render.RichRenderer.encodeAllChildrenInContext(RichRenderer.java:3062)
         at oracle.adfinternal.view.faces.renderkit.rich.PageTemplateRenderer.encodeAll(PageTemplateRenderer.java:69)
         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:493)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:913)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1661)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:607)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:623)
         at oracle.adf.view.rich.render.RichRenderer.encodeAllChildrenInContext(RichRenderer.java:3062)
         at oracle.adfinternal.view.faces.renderkit.rich.RegionRenderer._encodeChildren(RegionRenderer.java:310)
         at oracle.adfinternal.view.faces.renderkit.rich.RegionRenderer.encodeAll(RegionRenderer.java:186)
         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:493)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:913)
         at oracle.adf.view.rich.component.fragment.UIXRegion.encodeEnd(UIXRegion.java:323)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1661)
         at org.apache.myfaces.trinidad.component.UIXGroup.encodeChildren(UIXGroup.java:170)
                    .....On checking further about this error code in Oracle® Fusion Middleware Error Messages Reference 11g Release 2 (11.1.2.0.0), it is given as
      ADF_FACES-60097: For more information, please see the server's error log for an
    entry beginning with: {0}
    Cause: An exception was thrown durring a PPR request.
    Action: Please look in the servers error log for more details on this error.
    Level: 1
    Type: ERROR
    Impact: LoggingI couldn't get any hint on what may be the issue. Can anyone help on this?
    Thanks in Advance.
    Perumal S

    I've seen this happen before if component objects are stored in managed beans (e.g. using binding="#{someBean.foo}").
    Problems like this can happen if the component is stored directly on the bean as a member variable (most commonly if the bean is application-scoped, session-scoped, or pageFlow-scoped but smaller scopes can exhibit the problem too).
    Usually just referencing the components from the accessors on JSF event objects during an event handlers or using one of the various component searching APIs (e.g. findComponent) can suffice in locating the components dynamically.
    However, if using one of those mechanisms isn't feasible you must use the ComponentReference as the storage mechanism (and follow the caveats noted in its JavaDoc):
    http://www.jarvana.com/jarvana/view/org/apache/myfaces/trinidad/trinidad-api/2.0.0-beta-1/trinidad-api-2.0.0-beta-1-javadoc.jar!/org/apache/myfaces/trinidad/util/ComponentReference.html
    Hope this helps,
    Matt

  • Error in  struts with collection classes

    Hi All,
    I have tried to list all the employee through dabase search i have created with strus logic tag in search.jsp page
    as following
    <bean:size id="size" name="searchForm" property="results"/>
    <logic:equal name="size" value="0">
    <center><font color="red"><b>No Employees Found</b></font></center>
    </logic:equal>
    <logic:greaterThan name="size" value="0">
    <table border="1">
    <tr>
    <th>Name</th>
    <th>Social Security Number</th>
    </tr>
    <logic:iterate id="result" name="searchForm" property="results">
    <tr><td><bean:write name="result" property="name"/></td>
    <td><bean:write name="result" property="ssNum"/></td>
    </tr>
    </logic:iterate>
    </table>
    </logic:greaterThan>
    </logic:present>
    2. The following class shows ActionServlet as SearchAction.java class
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,HttpServletResponse response)
    throws Exception
    EmployeeSearchService service = new EmployeeSearchService();
    List results=new ArrayList();;
    SearchForm searchForm = (SearchForm) form;
    // Perform employee search based on what criteria was entered.
    String name = searchForm.getName();
    if (name != null && name.trim().length() > 0)
    results = service.searchByName(name);
    /* else {
    results = service.searchBySsNum(searchForm.getSsNum().trim());
    // Place search results in SearchForm for access by JSP.
    searchForm.setResults(results);
    // Forward control to this Action's input page.
    return mapping.getInputForward();
    3. The following class created for search the employee as EmployeeSearchService.java
    Note: This file will implement EmployeeDB.java for database connections and also the values are return using Employee.java as for get and set method of name and id..
    EmployeeSearchService.java
    public List searchByName(String name)
    // List returnList=new ArrayList();
    List results=new ArrayList();
    EmployeeDB em=new EmployeeDB();
    results=em.searchName(name);
    ListIterator langIt=results.listIterator();
    while(langIt.hasNext())
    Employee emp=(Employee) langIt.next();
    String name2 = emp.getName();
    String SSNo=emp.getSsNum();
    System.out.println("Emp Name:"+ name2);
    results.add(name2);
    results.add(SSNo);
    4. EmployeeDB.java contain the following code..
    public class EmployeeDB extends AbstractDAO
    public List searchName(String name1)
    {      //External Interface
    List resultList = new ArrayList();
    ResultSet resultSet = null;
    Statement aStmt2 = null;
    String url="jdbc:odbc:test";
    String uname="root";
    String pwd="root";
    String name="";
    try {
    Connection con=getConnection();
    aStmt2 = con.createStatement();
    String query2 = "SELECT SSNO,NAME FROM EMPLOYEE WHERE NAME ='"+ name1 +"'";
    cat.debug(query2);
    resultSet = aStmt2.executeQuery(query2);
    while(resultSet.next()){
    Employee tvo = new Employee();
    name = resultSet.getString("NAME");
    String SsNum1 = resultSet.getString("SSNO");
    tvo.setName(name);
    tvo.setSsNum(SsNum1);
    resultList.add(tvo);
    catch (Exception e) {
    System.out.println( e);
    e.printStackTrace();
    return resultList;
    My Problem is all the classes are compiled and excute and validation work fine but while the name of employee entered that if name is available in DB table which reply the following error message as,
    javax.servlet.ServletException
         org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516)
         org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:423)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
    root cause
    java.util.ConcurrentModificationException
         java.util.AbstractList$Itr.checkForComodification(AbstractList.java:449)
         java.util.AbstractList$Itr.next(AbstractList.java:420)
         com.dao.vertex.EmployeeSearchService.searchByName(EmployeeSearchService.java:77)
         com.dao.vertex.SearchAction.execute(SearchAction.java:36)
         org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs
    Plz reply how to solve send correct code to send data to values of iterate bean.... which line of code i need to modify...
    Thanks.

    So here is what you are doing:
    ArrayList results = //get employees from database
    ListIterator langIt = results.listIterator();
    while (langIt.hasNext()) {
      Employee emp = langIt.next();
      String name2 = emp.getName();
      String SSNo = emp.getSSNum();
      results.add(name2);
      results.add(SSNo);
    }So you get a list or Employee objects, then you get an iterator over the list. For each Employee in the list you add the name and SSNo as Strings back to the same list. From the API for ConcurrentModificationException the exception can be thrown when you modify a collection while iterating over the collection - which is precisely what you are doing.
    The ListIterator interface allows you to modify the list through its own methods. Try using:
      langIt.add(name2);
      langIt.add(SSNo);instead.
    Why are you taking the name and SSNo out of the Employee object and placing them back in the same List anyway? That makes no sense to me.

  • ConcurrentModificationException for a GeneralPath

    I've got a problem that I don't know how to solve.
    I've got a GeneralPath, let's call it path. I've got the normal EDT thread running. I've got a JPanel in a JFrame. I also got a communication thread (separate thread).
    Now, I get coordinates to add to the path via the communication thread. This happens sporadically, let's say every 200ms. This thread in turn accesses a class existing in the EDT that adds points to the path.
    The JPanel reads the generalpath in an overridden paintComponent(Graphics g) class and thus read from the path.
    Sometimes I assume the communcation thread tries to add a new part to the path, while the paintComponent tries to draw it. So I get a:
    "Lane.draw(Lane.java:46) exception ConcurrentModificationException"
    I am wondering how I would go about to fix this? I assume it isn't dangerous, since the draw method only reads the path. But still, what should I do or what am I doing wrong?
    Appreciate help!

    Make sure you have one place to access all the data that is shared between the two threads (lets call this place a model). In the model you synchronize on an object before reading or writing (as the other poster noted). The concurrent modification exception is most likely caused by you iterating over an array and make changes on it from the other thread at the same time. So make sure that you synchronize this behavior: if you are iterating, you can not make changes and the other way around.

  • Error 'Inconsistent datatypes' with Java classes

    Hi,
    I have some Java classes loaded in Oracle 8.1.6, mapped as Object Types, so when I create one object from PL/SQL, JVM ought to create the matching Java object, communicating via the SQLData interface.
    Unfortunately, after the code:
    pippo:=OraMailer('mail.server.com','mymail');
    that creates the PL/SQL object, any code that use member procedures or function wrapping instance methods of the Java class fails with the error 932: Inconsistent datatypes.
    I looked for a mistake in my PL/SQL and Java code, but no error was found.
    It is very important: help me!!!
    Thx

    So here is what you are doing:
    ArrayList results = //get employees from database
    ListIterator langIt = results.listIterator();
    while (langIt.hasNext()) {
      Employee emp = langIt.next();
      String name2 = emp.getName();
      String SSNo = emp.getSSNum();
      results.add(name2);
      results.add(SSNo);
    }So you get a list or Employee objects, then you get an iterator over the list. For each Employee in the list you add the name and SSNo as Strings back to the same list. From the API for ConcurrentModificationException the exception can be thrown when you modify a collection while iterating over the collection - which is precisely what you are doing.
    The ListIterator interface allows you to modify the list through its own methods. Try using:
      langIt.add(name2);
      langIt.add(SSNo);instead.
    Why are you taking the name and SSNo out of the Employee object and placing them back in the same List anyway? That makes no sense to me.

  • Kernel java.util.ConcurrentModificationException

    Hi, I have got a few of these exceptions on one of my clustered weblogic server 9.2:
    Id = BEA-000802
    UserId = <WLS Kernel>
    TransactionId =
    ThrowableInfo = java.util.ConcurrentModificationException
         at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:617)
         at java.util.LinkedList$ListItr.next(LinkedList.java:552)
         at weblogic.jms.common.CDSLocalProxy.peerGone(CDSLocalProxy.java:318)
         at weblogic.jms.common.CDSLocalProxy.dispatcherPeerGone(CDSLocalProxy.java:307)
         at weblogic.messaging.dispatcher.DispatcherWrapperState.run(DispatcherWrapperState.java:561)
         at weblogic.messaging.dispatcher.DispatcherWrapperState.timerExpired(DispatcherWrapperState.java:486)
         at weblogic.timers.internal.TimerImpl.run(TimerImpl.java:265)
         at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
    Severity = 8
    ThreadName = [ACTIVE] ExecuteThread: '29' for queue: 'weblogic.kernel.Default (self-tuning)'
    Message = ExecuteRequest failed
    java.util.ConcurrentModificationException.
    Subsystem = KernelDoes someone know if there could be something that I am doing in my application ?
    thanks,
    v.

    Kodo 2.x seems to occasionally have issues with metadata registration
    and parsing. These have been resolved in 3.0. If you do not wish to
    upgrade at this time, you might try specifying all your persistent
    classes in the com.solarmetric.kodo.PersistentTypes configuration property.

  • ConcurrentModificationException in drawing code

    Hi all,
    I'm getting a ConcurrentModificationException and I'm having a bit of a hard time figuring out how to prevent it - I can't even really understand why it happens yet.
    I'm running a simulation of moving bodies in some world, and am using a Swing Timer to fire drawing events. The events fired by the timer are handled by a class WorldView, which draws the world and in turn uses BodyView objects to draw the bodies in the world. The exception occurs in the following code:
    public class SimAgentBodyView extends AgentBodyView {
      @Override
      public void draw( Graphics g) {
        Graphics2D g2d = (Graphics2D) g;
        g2d.setColor(Color.red);
        //cam is a simulated camera object mounted on the agent body               
        List<ISimBody> visBodies = cam.getVisibleObjects();
        for ( Body b : visBodies ) //Exception occurs in this loop
         g2d.draw(b.getFigure().getBounds2D());So apparently the visBodies list is being modified somewhere else while the drawing occurs. I don't really get this since I only use a single thread for the simulation which executes in the even-dispatching thread. The Timer runs in a separate thread but according to the API the event handler for the timer executes in the event-dispatching thread; i.e. both the simulation and the drawing mechanism are executing in the event-dispatching thread, so how can the simulation modify the list while the drawing happens?
    I'm rather short on time and the drawing is usually switched off to speed up the simulation anwyay, so even if it is not obvious what the problem is, is there a quick way to fix this? E.g. adding a synchronized block to the drawing code?
    Thanks
    Matt

    jverd wrote:
    CME is thrown on a best effort basis. There's no guarantee when it will be thrown, or even that it will be at all.I understand, thanks.
    Before you avoid the clear and simple solution for performance reasons, have you actually tested and found a performance problem with it?Good point, I haven't. But from profiling the app I know that during a standard run the list will be modified around 400 million times, and read (a loop through the entire list) about 200k - 800k times, depending on how long the run takes. From what I've read it seems that a concurrent collection will take significantly longer in this case. But you're right, maybe I should just try.
    I only posted a tiny bit of the code because at the time I did think that was the relevant bit, since I was under the impression that there was just a single thread accessing the list. The complete code follows, although again I'll take out parts that do not involve the list to make it clearer.
    public class LineCamera implements PhysicalSensor {
         public List<ISimBody> getVisibleObjects() {
              return visibleObjects;
         @Override
         public double[] getReading() {
              List<Body> objectsInRange = world.getIntersectingObjects(visionArea);
              visibleObjects.clear(); //<--- List is cleared here
              calcImage(objectsInRange);
              return image;
            public void calcImage( List<Body> objects ) {
              Set<BodyDistance> sortedObjs = sortObjectsByDistance(objects);
              for ( Path2D.Double slice : slices ) {
                   for ( BodyDistance obj : sortedObjs ) {
                        if ( slice.intersects(obj.bounds) ) {
                             visibleObjects.add(obj.body); //<--- List is modified here
                                            ...The code that reads the list is just the code that I posted earlier. The quick and dirty solution that I adopted now is just to clone the list in the code that does the drawing. Since the drawing is mainly for testing and seeing what's going on, speed is not so important there. Plus this avoids having to synchronize the modifications on the list; since this code is always executed (even when drawing is switched off), speed is of the essence. However it's quite nasty of course so if you know of anything better please let me know. Thanks!

  • Java.util.ConcurrentModificationException

    What is causing this?
    java.util.ConcurrentModificationException
    at java.util.HashMap$HashIterator.nextEntry(HashMap.java:762)
    at java.util.HashMap$KeyIterator.next(HashMap.java:798)
    at serp.util.LookaheadIterator.setNext(LookaheadIterator.java:135)
    at serp.util.LookaheadIterator.next(LookaheadIterator.java:60)
    at
    com.solarmetric.kodo.impl.jdbc.JDBCPersistenceManagerFactory.flushDeferredRe
    gistrations(JDBCPersistenceManagerFactory.java:512)
    at
    com.solarmetric.kodo.impl.jdbc.JDBCPersistenceManagerFactory.configurePersis
    tenceManager(JDBCPersistenceManagerFactory.java:669)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerFactoryImpl.newPersistenceMan
    ager(PersistenceManagerFactoryImpl.java:674)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerFactoryImpl.getPersistenceMan
    ager(PersistenceManagerFactoryImpl.java:208)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerFactoryImpl.getPersistenceMan
    ager(PersistenceManagerFactoryImpl.java:140)
    I'm using 2.5.5

    Kodo 2.x seems to occasionally have issues with metadata registration
    and parsing. These have been resolved in 3.0. If you do not wish to
    upgrade at this time, you might try specifying all your persistent
    classes in the com.solarmetric.kodo.PersistentTypes configuration property.

  • Java.util.ConcurrentModificationException while getObjectById

    I use Kodo 3.0.2:
    I want to retrieve an objkect by its primary key (primary key class) in a
    stateless session bean. This is the first time I call a method on the
    PersistenceManager retrieved over JNDI.
    The code is:
    public synchronized long getNextIdentity(String numberRange) {
    IdentityMaxKey id = new IdentityMaxKey();
    id.setNumberRange(numberRange);
    IdentityMax im = null;
    im = (IdentityMax) pm.getObjectById(id, true); <-- Exception
    return im.getAndIncMaxId();
    And the result is the java.util.ConcurrentModificationException on the
    appServer (JBoss 3.2.3). Whats wrong?
    com.cmptsis.util.exception.ConfigurationException: Remote Exception while
    accessing App-Server
         at
    com.cmptsis.kiff.customer.delegate.ejb.CustomerDelegateImpl.createGroup(CustomerDelegateImpl.java:49)
         at
    com.cmptsis.kiff.client.swing.TestFrame.createTestCustomerData(TestFrame.java:43)
         at com.cmptsis.kiff.client.swing.TestFrame.main(TestFrame.java:33)
    Caused by: java.rmi.ServerException: RemoteException occurred in server
    thread; nested exception is:
         java.rmi.ServerException: RuntimeException; nested exception is:
         kodo.util.FatalException: kodo.util.FatalException:
    java.util.ConcurrentModificationException
    NestedThrowables:
    java.util.ConcurrentModificationException
    NestedThrowables:
    java.util.ConcurrentModificationException
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
         at sun.rmi.transport.Transport$1.run(Transport.java:148)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
         at
    sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at
    sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:534)
         at
    sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
         at
    sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
         at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown
    Source)
         at
    org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)
         at
    org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:96)
         at
    org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
         at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
         at
    org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
         at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
         at $Proxy1.createGroup(Unknown Source)
         at
    com.cmptsis.kiff.customer.delegate.ejb.CustomerDelegateImpl.createGroup(CustomerDelegateImpl.java:46)
         ... 2 more
    Caused by: java.rmi.ServerException: RuntimeException; nested exception
    is:
         kodo.util.FatalException: kodo.util.FatalException:
    java.util.ConcurrentModificationException
    NestedThrowables:
    java.util.ConcurrentModificationException
    NestedThrowables:
    java.util.ConcurrentModificationException
         at
    org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:361)
         at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
         at
    org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
         at
    org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
         at org.jboss.ejb.Container.invoke(Container.java:700)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at
    org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
         at
    org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
         at sun.rmi.transport.Transport$1.run(Transport.java:148)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
         at
    sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at
    sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:534)
    Caused by: kodo.util.FatalException: kodo.util.FatalException:
    java.util.ConcurrentModificationException
    NestedThrowables:
    java.util.ConcurrentModificationException
    NestedThrowables:
    java.util.ConcurrentModificationException
         at kodo.util.FatalException.writeReplace(FatalException.java:74)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at
    java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:896)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1011)
         at
    java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
         at
    java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
         at
    java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
         at
    java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
         at
    java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
         at
    java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:299)
         ... 6 more
    Caused by: java.util.ConcurrentModificationException
         at java.util.HashMap$HashIterator.nextEntry(HashMap.java:782)
         at java.util.HashMap$KeyIterator.next(HashMap.java:818)
         at
    kodo.meta.JDOMetaDataRepositoryImpl.processRegisteredClasses(JDOMetaDataRepositoryImpl.java:522)
         at
    kodo.meta.JDOMetaDataRepositoryImpl.getMetaData(JDOMetaDataRepositoryImpl.java:340)
         at
    kodo.meta.DelegatingJDOMetaDataRepository.getMetaData(DelegatingJDOMetaDataRepository.java:167)
         at kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:248)
         at
    kodo.jdbc.meta.MappingRepository.getMetaData(MappingRepository.java:237)
         at
    kodo.runtime.PersistenceManagerImpl.newStateManager(PersistenceManagerImpl.java:1316)
         at
    kodo.runtime.PersistenceManagerImpl.getObjectById(PersistenceManagerImpl.java:1280)
         at
    kodo.runtime.PersistenceManagerImpl.getObjectById(PersistenceManagerImpl.java:1223)
         at
    com.cmptsis.kiff.global.server.identity.jdo.JdoIdentityDAO.getNextIdentity(JdoIdentityDAO.java:21)
         at
    com.cmptsis.kiff.global.server.identity.StandardDBIdentityFacade.nextIdentityByRange(StandardDBIdentityFacade.java:16)
         at
    com.cmptsis.kiff.customer.server.facade.CustomerFacadeLogic.createGroup(CustomerFacadeLogic.java:24)
         at
    com.cmptsis.kiff.customer.server.facade.ejb.CustomerSessionBean.createGroup(CustomerSessionBean.java:80)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at
    org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
         at
    org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
         at
    org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
         at
    org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
         at
    org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
         at
    org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
         at
    org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
         at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
         at
    org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
         at
    org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
         at org.jboss.ejb.Container.invoke(Container.java:700)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at
    org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
         at
    org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
         ... 6 more
    Exception in thread "main"

    The issue is not solved yet...
    Bernd Ruecker wrote:
    I use Kodo 3.0.2:
    I want to retrieve an objkect by its primary key (primary key class) in a
    stateless session bean. This is the first time I call a method on the
    PersistenceManager retrieved over JNDI.
    The code is:
    public synchronized long getNextIdentity(String numberRange) {
    IdentityMaxKey id = new IdentityMaxKey();
    id.setNumberRange(numberRange);
    IdentityMax im = null;
    im = (IdentityMax) pm.getObjectById(id, true); <-- Exception
    return im.getAndIncMaxId();
    And the result is the java.util.ConcurrentModificationException on the
    appServer (JBoss 3.2.3). Whats wrong?
    com.cmptsis.util.exception.ConfigurationException: Remote Exception while
    accessing App-Server
         at
    com.cmptsis.kiff.customer.delegate.ejb.CustomerDelegateImpl.createGroup(CustomerDelegateImpl.java:49)
         at
    com.cmptsis.kiff.client.swing.TestFrame.createTestCustomerData(TestFrame.java:43)
         at com.cmptsis.kiff.client.swing.TestFrame.main(TestFrame.java:33)
    Caused by: java.rmi.ServerException: RemoteException occurred in server
    thread; nested exception is:
         java.rmi.ServerException: RuntimeException; nested exception is:
         kodo.util.FatalException: kodo.util.FatalException:
    java.util.ConcurrentModificationException
    NestedThrowables:
    java.util.ConcurrentModificationException
    NestedThrowables:
    java.util.ConcurrentModificationException
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
         at sun.rmi.transport.Transport$1.run(Transport.java:148)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
         at
    sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at
    sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:534)
         at
    sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
         at
    sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
         at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown
    Source)
         at
    org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)
         at
    org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:96)
         at
    org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
         at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
         at
    org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
         at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
         at $Proxy1.createGroup(Unknown Source)
         at
    com.cmptsis.kiff.customer.delegate.ejb.CustomerDelegateImpl.createGroup(CustomerDelegateImpl.java:46)
         ... 2 more
    Caused by: java.rmi.ServerException: RuntimeException; nested exception
    is:
         kodo.util.FatalException: kodo.util.FatalException:
    java.util.ConcurrentModificationException
    NestedThrowables:
    java.util.ConcurrentModificationException
    NestedThrowables:
    java.util.ConcurrentModificationException
         at
    org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:361)
         at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
         at
    org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
         at
    org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
         at org.jboss.ejb.Container.invoke(Container.java:700)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at
    org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
         at
    org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
         at sun.rmi.transport.Transport$1.run(Transport.java:148)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
         at
    sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at
    sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:534)
    Caused by: kodo.util.FatalException: kodo.util.FatalException:
    java.util.ConcurrentModificationException
    NestedThrowables:
    java.util.ConcurrentModificationException
    NestedThrowables:
    java.util.ConcurrentModificationException
         at kodo.util.FatalException.writeReplace(FatalException.java:74)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at
    java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:896)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1011)
         at
    java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
         at
    java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
         at
    java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
         at
    java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
         at
    java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
         at
    java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:299)
         ... 6 more
    Caused by: java.util.ConcurrentModificationException
         at java.util.HashMap$HashIterator.nextEntry(HashMap.java:782)
         at java.util.HashMap$KeyIterator.next(HashMap.java:818)
         at
    kodo.meta.JDOMetaDataRepositoryImpl.processRegisteredClasses(JDOMetaDataRepositoryImpl.java:522)
         at
    kodo.meta.JDOMetaDataRepositoryImpl.getMetaData(JDOMetaDataRepositoryImpl.java:340)
         at
    kodo.meta.DelegatingJDOMetaDataRepository.getMetaData(DelegatingJDOMetaDataRepository.java:167)
         at kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:248)
         at
    kodo.jdbc.meta.MappingRepository.getMetaData(MappingRepository.java:237)
         at
    kodo.runtime.PersistenceManagerImpl.newStateManager(PersistenceManagerImpl.java:1316)
         at
    kodo.runtime.PersistenceManagerImpl.getObjectById(PersistenceManagerImpl.java:1280)
         at
    kodo.runtime.PersistenceManagerImpl.getObjectById(PersistenceManagerImpl.java:1223)
         at
    com.cmptsis.kiff.global.server.identity.jdo.JdoIdentityDAO.getNextIdentity(JdoIdentityDAO.java:21)
         at
    com.cmptsis.kiff.global.server.identity.StandardDBIdentityFacade.nextIdentityByRange(StandardDBIdentityFacade.java:16)
         at
    com.cmptsis.kiff.customer.server.facade.CustomerFacadeLogic.createGroup(CustomerFacadeLogic.java:24)
         at
    com.cmptsis.kiff.customer.server.facade.ejb.CustomerSessionBean.createGroup(CustomerSessionBean.java:80)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at
    org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
         at
    org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
         at
    org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
         at
    org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
         at
    org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
         at
    org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
         at
    org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
         at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
         at
    org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
         at
    org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
         at org.jboss.ejb.Container.invoke(Container.java:700)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at
    org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
         at
    org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
         ... 6 more
    Exception in thread "main"

  • ConcurrentModificationException when operating on an ArrayList

    Hi,
    I've got a strange problem. I'm working with a heavily multithreaded program. I have the following code:
    public abstract class GHAgentTaskThread implements Runnable, GenericObserverSubject {
    protected List observingResultDispatchers = new ArrayList();
    public final void addObserver(GenericObserverObserver subscriber) {
    synchronized (observingResultDispatchers) {
    observingResultDispatchers.add(subscriber);
    public final void removeObserver(GenericObserverObserver subscriber) {
    synchronized (observingResultDispatchers) {
    observingResultDispatchers.remove(subscriber);
    protected final void notifyObservingDispatchers() {
    synchronized (observingResultDispatchers) {
    Iterator i = observingResultDispatchers.iterator();
    GenericObserverObserver currentObserver;
    while (i.hasNext()) {
    currentObserver = (GenericObserverObserver) i.next(); //****
    currentObserver.notify(this);
    observersIterator = null;
    //Other stuff
    public class TokenryServerRequestTokenTask
    extends GHAgentTaskThread
    implements Runnable {
    public void run() {
    //do some stuff
    notifyObservingDispatchers();
    I have an external class which creates a new instance of the thread:
    GHAgentTaskThread myThread = new TokenryServerRequestTokenTask();
    It then adds itself as a listener:
    myThread.addObserver(this);
    This all works ok. I then start then thread and it goes and does the work I've specified. However, at the end of the run method when I try and notify the observers that the work is done with notifyObservingDispatchers(), I'm getting a:
    java.util.ConcurrentModificationException
    at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:444)
    at java.util.AbstractList$Itr.next(AbstractList.java:421)
    The line this is happeneing at is the :
    currentObserver = (GenericObserverObserver) i.next();
    line, which I've marked //**** in the code above.
    Why is this happening? I thought, that given I've synchronized all of the code that deals with the List (which is private) on the List itself that only one thing could be operating on it at one time, and hence this shouldn't occur. Strangely enough too, it doesn't seem to be affecting my program either - it works. However, exceptions are not thrown for no reason!
    If anyone can suggest how this could be sorted I'd be very grateful.
    Many thanks,
    Stu

    To englarge slightly on what _JN said, I speculate
    that when your GenericObserverObserver.notify() method
    is called, it calls one of your other methods in a way
    that modifies the list.
    cut
    Got it in one - I've just spotted that. I was attempting to remove the observer from the subject from within the GenericObserverObserver.notify() method... whoops!
    Cheers for the suggestion about the LinkedList - that's also a good idea.
    Thank you both for your help.
    Cheers,
    Stu

  • Synchronized and java.util.ConcurrentModificationException

    Hi,
    I keep getting a java.util.ConcurrentModificationException when running the following code:
    ArrayList tObjects = ...
    synchronized (tObjects) {
    Iterator tObjectsIterator = tObjects.iterator();
    while (tObjectsIterator.hasNext()) {
    Object tObject = tObjectsIterator.next(); -----> Exception
    I run synchronized on tObjects so I can't understand why (and how) I get the Exception, can anyone help?
    Thanks,
    Iggy

    thanks for the help, I still have some difficulties:
    I have a (static) class ObjectsHolder which holds an ArrayList tObjects, I have various methods that access the ArrayList and return one/some elements.
    I would like to synchrinize on the ArrayList tObjects in ObjectsHolder, but the holder returns the ArrayList itself I am unsure whether the access to the ArrayList will be synchronized even in the calling method.
    A.

  • ConcurrentModificationException in transactional operations

    I'm trying to do simple puts on a transactional cache with these settings. The puts do not conflict with each other on their keys.
    connection.setAutoCommit(false);
    connection.setIsolationLevel(Isolation.READ_COMMITTED);
    connection.setEager(false);As soon as a few transactions have completed I start seeing these errors. After that all other transactions also fail with confusing exceptions - some about ClassNotFound and some about txns already being committed.
    java.util.ConcurrentModificationException
         at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
         at java.util.AbstractList$Itr.next(AbstractList.java:343)
         at com.tangosol.coherence.transaction.internal.TranscriptImpl.getModifiedTables(TranscriptImpl.java:66)
         at com.tangosol.coherence.transaction.internal.storage.Session.getModifiedTables(Session.java:79)
         at com.tangosol.coherence.transaction.internal.storage.Session.queueOperation(Session.java:35)
         at com.tangosol.coherence.transaction.internal.router.LocalDirector.route(LocalDirector.java:41)
         at com.tangosol.coherence.transaction.internal.Endpoint.dispatch(Endpoint.java:105)
         at com.tangosol.coherence.transaction.internal.OptimisticNamedCacheImpl.invoke(OptimisticNamedCacheImpl.java:708)
         at com.tangosol.coherence.transaction.internal.OptimisticNamedCacheImpl.put(OptimisticNamedCacheImpl.java:370)
    java.lang.IllegalStateException: Operation called in illegal state: COMMITTED
         at com.tangosol.coherence.transaction.internal.TransactionImpl.assertStateChange(TransactionImpl.java:313)
         at com.tangosol.coherence.transaction.internal.TransactionImpl.setCommitted(TransactionImpl.java:140)
         at com.tangosol.coherence.transaction.internal.component.ClientAutoCommit.invoke(ClientAutoCommit.java:76)
         at com.tangosol.coherence.transaction.internal.Endpoint.dispatch(Endpoint.java:95)
         at com.tangosol.coherence.transaction.internal.router.StaticEndpointConcern.apply(StaticEndpointConcern.java:48)
         at com.tangosol.coherence.transaction.internal.router.OperationFilter.apply(OperationFilter.java:51)
         at com.tangosol.coherence.transaction.internal.router.OutboundRouterImpl.route(OutboundRouterImpl.java:36)
         at com.tangosol.coherence.transaction.internal.Endpoint.dispatch(Endpoint.java:105)
         at com.tangosol.coherence.transaction.internal.router.StaticEndpointConcern.apply(StaticEndpointConcern.java:48)
         at com.tangosol.coherence.transaction.internal.router.OperationFilter.apply(OperationFilter.java:51)
         at com.tangosol.coherence.transaction.internal.router.OutboundRouterImpl.route(OutboundRouterImpl.java:36)
         at com.tangosol.coherence.transaction.internal.Endpoint.dispatch(Endpoint.java:105)
         at com.tangosol.coherence.transaction.internal.router.StaticEndpointConcern.apply(StaticEndpointConcern.java:48)
         at com.tangosol.coherence.transaction.internal.router.OperationFilter.apply(OperationFilter.java:51)
         at com.tangosol.coherence.transaction.internal.router.OutboundRouterImpl.route(OutboundRouterImpl.java:36)
         at com.tangosol.coherence.transaction.internal.Endpoint.dispatch(Endpoint.java:105)
         at com.tangosol.coherence.transaction.internal.router.StaticEndpointConcern.apply(StaticEndpointConcern.java:48)
         at com.tangosol.coherence.transaction.internal.router.OperationFilter.apply(OperationFilter.java:51)
         at com.tangosol.coherence.transaction.internal.router.OutboundRouterImpl.route(OutboundRouterImpl.java:36)
         at com.tangosol.coherence.transaction.internal.router.LocalDirector.route(LocalDirector.java:56)
         ... 22 moreSometimes:
    java.lang.IllegalStateException: Operation called in illegal state: ERROR
    ...Any ideas?
    Thanks,
    Ashwin.

    I suppose this is the correct way to use optimistic, transactional caches:
    * Author: Ashwin Jayaprakash / Date: 1/4/12 / Time: 12:32 PM
    public class TxnTest {
        protected static final ThreadLocal<Connection> connections = new ThreadLocal<Connection>();
        protected static DefaultConnectionFactory connectionFactory;
        public static void main(String[] args) throws Exception {
            connectionFactory = new DefaultConnectionFactory();
            for (int i = 0; i < 5; i++) {
                runTest();
        private static void runTest() throws InterruptedException {
            Runnable job = new Runnable() {
                @Override
                public void run() {
                    String name = Thread.currentThread().getName();
                    for (int i = 0; i < 100; i++) {
                        for (int j = 0; j < 3; j++) {
                            if (j > 0) {
                                System.out.printf("Txn [%s-%d] retry attempt [%d]%n", name, i, j);
                            Connection connection = connectionFactory.createConnection();
                            connection.setAutoCommit(false);
                            connection.setIsolationLevel(Isolation.READ_COMMITTED);
                            connection.setEager(false);
                            OptimisticNamedCache users = connection.getNamedCache("tx-users");
                            try {
                                users.put("bill", new User("bill-" + name, i));
                                users.put("mary", new User("mary-" + name, i));
                                users.put("john", new User("john-" + name, i));
                                connection.commit();
                                break;
                            catch (Exception e) {
                                connection.rollback();
                            finally {
                                connection.close();
            Thread t1 = new Thread(job);
            Thread t2 = new Thread(job);
            t1.start();
            t2.start();
            t1.join();
            t2.join();
            System.out.println("Entries: " + CacheFactory.getCache("tx-users").size());
            for (Object o : CacheFactory.getCache("tx-users").values()) {
                System.out.println("   " + o);
        public static class User implements Serializable {
            String name;
            int age;
            public User() {
            public User(String name, int age) {
                this.name = name;
                this.age = age;
            public String getName() {
                return name;
            public int getAge() {
                return age;
            @Override
            public String toString() {
                final StringBuilder sb = new StringBuilder();
                sb.append(getClass().getName());
                sb.append("{name='").append(name).append('\'');
                sb.append(", age=").append(age);
                sb.append('}');
                return sb.toString();
    }

  • ConcurrentModificationException in List

    In the following code I am getting a ConcurrentModificationException that I can't seem to rectify.
    I have tried
    1. sync'ing the 2 public methods
    2. sync'ing within the methods (currently shown in code) this was most often recommended in forums that I have read on this problem.
    3. sync'ing on the current object ("this", as shown in the code) and sync'ing on the list object itself.
    4. Using Collections.synchronizedList(new Vector ...)
    After chasing the problem I am pretty sure that the .add method is being called while the Iteraor loop is running, but shouldn't sync'ing fix that? The list is private and is not accessed from any other class outside the current one shown. Is there something wrong with my sync'ing?
    Any recommendations will be appreciated.
    Thanks,
    sseric
    Error:
    Exception in thread "Thread-2" java.util.ConcurrentModificationException
    at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:449)
    at java.util.AbstractList$Itr.next(AbstractList.java:420)
    at genetviz.utils.BroadcastGraphAction.broadcast(BroadcastGraphAction.java:80)
    at genetviz.utils.Graph.init(Graph.java:106)
    at genetviz.io.FileOpener$FileLoader.run(FileOpener.java:312)
    at java.lang.Thread.run(Thread.java:595)
    Code:
    import java.util.*;
    import javax.swing.event.ChangeEvent;
    import java.awt.Component;
    import java.awt.Dimension;
    public abstract class BroadcastGraphAction extends GraphRenderer
         implements GraphListener {
    public abstract void setGraph(Graph graph);
    private Vector<GraphListener> graphListenerList = new Vector<GraphListener>();
    public void addGraphListener(GraphListener gl)
    synchronized(this)
    graphListenerList.add(gl);
    public void broadcast(Graph gr)
    if(gr == null) return;
    synchronized(this)
    for (Iterator iter = graphListenerList.iterator(); iter.hasNext();)
    Object obj = iter.next();
    if (obj instanceof GraphListener) ((GraphListener)obj).setGraph(gr);
    }

    takeshi10,
    please see below for response,
    when posting code, remember to use code tags...thank you. I'm new to the forums
    except operations with the iterator, you shouldnt add / remove items on the list while iterating over it...yep, that's the problem.
    i believe the setGraph method is adding the Graph to the list (tough, because of its abstractness i cant really tell)...no. the "Graph" is independent of the "GraphListener" and is not being added to the graphListenerList. The problem appears to be that .add is being called after .iterator is called on the graphListenerList. This is what I need to prevent through synchronization, or other techniques.
    sync'inc will only prevent acess by other threads... right, which is why I used it in my code. So one of 2 things is happening then,
    1. my synchronization is correct and it is not another thread causing the exception
    2. Something is wrong with my synchronization
    Though I'm not familiar with this, I tried something on the first note. I created a thread in the current class keeping it alive with a while loop and Thread.sleep, and I tried locking on it to ensure that an independent thread controlled the locking, for example,
    public void addGraphListener(GraphListener gl)
         if(lock==null)
         { lock = new Thread(new LockRunner());}
         synchronized(lock)
            graphListenerList.add(gl);
      private class LockRunner extends Object implements Runnable
         public void run()
            try {
              while(true) Thread.sleep(1000);
               } catch (InterruptedException e) {
                System.out.println("BroadcastGraphAction sleep exception");
    public void broadcast(Graph gr)
         if(gr == null) return;
         if(lock==null)
           lock = new Thread(new LockRunner());
         synchronized(lock)
           for (Iterator iter = graphListenerList.iterator(); iter.hasNext();)
               Object obj = iter.next();
               if (obj instanceof GraphListener) ((GraphListener)obj).setGraph(gr);
      }This did not work either. Unfortunately, I am only marginally experienced with threads and thread locking so I'm not quite sure I'm getting this right (well, obvioudly I'm not getting this right). Other suggestions?
    sseric

  • Why am I still getting ConcurrentModificationException?!

    Here is a simple test that I ran on a collection that I have implemented, in which I try to add multiple objects to the collection in multiple threads. I have labelled the methods which modify the colleciton as synchronized, so I had thought it would not allow more than one LinkedCollection.add operation at a time. However, I am getting ConcurrentModificationExceptions from it. Below the test I have included the code for my LinkedCollection class and all other relevant classes, so that it's possible for anyone here to run it if needed. Thanks for any help!
    ==========================================================================================
    public class ThreadTest {
        public static void main(String[] args) {
            LinkedCollection<Integer> c = new LinkedCollection<Integer>();
            for (int i = 0; i < 10; i++) {
                Thread t = new Thread(new Berk(c, i * 10), "Thread " + i);
                t.start();
            System.out.println(c);
        static class Berk implements Runnable {
            private LinkedCollection<Integer> c;
            private int i;
            public Berk(LinkedCollection<Integer> c, int i) {
                this.c = c;
                this.i = i;
            public void run() {
                for (int i = 0; i < 10; i++)
                    c.add(this.i + i);
    }==========================================================================================
    import java.util.Collection;
    public class LinkedCollection<E> implements Collection<E>, PublicCloneable<LinkedCollection<E>>, ModificationEventGenerator {
        protected Position<E> head;
        protected int size;
        private LinkedCollection<ModificationListener> listeners;
        public LinkedCollection() {
            this(true);
        protected LinkedCollection(boolean notifyModifications) {
            listeners = notifyModifications ? new LinkedCollection<ModificationListener>(false) : null;
        public boolean isEmpty() {
            return head == null;
        public boolean contains(Object element) {
            return getFirstPosition(element) != null;
        public boolean containsAny(Collection<?> c) {
            for (Object element : c)
                if (contains(element))
                    return true;
            return false;
        public boolean containsAll(Collection<?> c) {
            for (Object element : c)
                if (!contains(element))
                    return false;
            return true;
        public int occurrences(Object element) {
            return getPositions(element).size();
        public int size() {
            return size;
        public synchronized boolean add(E element) {
            if (element != null) {
                generateModificationEvent();
                if (isEmpty())
                    head = new Position<E>(element);
                else
                    head.prev = head.prev.next = new Position<E>(element, head.prev, head);
                size++;
                return true;
            return false;
        public synchronized boolean addAll(Collection<? extends E> c) {
            boolean changed = false;
            for (E element : c)
                if (add(element))
                    changed = true;
            return changed;
        public synchronized boolean remove(Object element) {
            LinkedCollection<Position<E>> removals = getPositions(element);
            for (Position<E> current : removals) {
                if (size == 1)
                    head = null;
                else {
                    if (current == head)
                        head = head.next;
                    current.prev.next = current.next;
                    current.next.prev = current.prev;
                    current.prev = current.next = current;
                size--;
            return generateModificationEvent(!removals.isEmpty());
        public synchronized boolean removeAll(Collection<?> c) {
            boolean changed = false;
            for (Object element : c)
                if (remove(element))
                    changed = true;
            return changed;
        public synchronized boolean retainAll(Collection<?> c) {
            LinkedCollection<E> removals = new LinkedCollection<E>();
            for (E element : this)
                if (!c.contains(element))
                    removals.add(element);
            for (E element : removals)
                this.remove(element);
            return !removals.isEmpty();
        public synchronized void clear() {
            Position next;
            while (size > 0) {
                next = head.next;
                head.prev = head.next = head;
                head = next;
                size--;
            head = null;
            if (listeners != null)
                listeners.clear();
        public Object[] toArray() {
            Object[] array = new Object[size];
            int index = 0;
            for (E element : this)
                array[index++] = element;
            return array;       
        public <T> T[] toArray(T[] type) {
            T[] array = type.length < size ? (T[]) new Object[size] : type;
            int index = 0;
            for (E element : this)
                array[index++] = (T)element;
            if (array.length > size)
                array[index] = null;
            return array;
        public String toString() {
            String s = "";
            for (E element : this)
                s += element.toString() + " ";
            return s;
        public boolean equals(Object o) {
            if (!(o instanceof Collection<?>))
                return false;
            LinkedCollection<?> s = (LinkedCollection<?>)o;
            for (Object element : s)
                if (occurrences(element) != s.occurrences(element))
                    return false;
            for (E element : this)
                if (!s.contains(element))
                    return false;
            return true;
        public int hashCode() {
            return 0;
        public LinkedCollection<E> clone() {
            LinkedCollection<E> clone = new LinkedCollection<E>();
            clone.addAll(this);
            return clone;
        public void addModificationListener(ModificationListener m) {
            if (listeners != null && !listeners.contains(m))
                listeners.add(m);
        public void removeModificationListener(ModificationListener m) {
            if (listeners != null)
                listeners.remove(m);
        public void generateModificationEvent() {
            if (listeners != null)
                for (ModificationListener m : listeners)
                    m.modified(new ModificationEvent(this));
        public boolean generateModificationEvent(boolean condition) {
            if (condition)
                generateModificationEvent();
            return condition;
        public final java.util.Iterator<E> iterator() {
            return new Iterator<E>(this, head, head);
        protected LinkedCollection<Position<E>> getPositions(Object element) {
            LinkedCollection<Position<E>> matches = new LinkedCollection<Position<E>>(false);
            if (!isEmpty()) {
                Position<E> match = head.prev;
                int count = 0;
                while (matches.add(match.next == head && count++ > 0 ? null : (match = getFirstPosition(element, match.next))));
            return matches;
        protected Position<E> getFirstPosition(Object element, Position<E> start) {
            if (!isEmpty()) {
                Iterator i = new Iterator(this, start, head);
                while (i.hasNext())
                    if (i.next().equals(element)) {
                        i.terminate();
                        return i.currentPosition();
            return null;
        protected Position<E> getFirstPosition(Object element) {
            return getFirstPosition(element, head);
    }==========================================================================================
    import java.util.ConcurrentModificationException;
    import java.util.NoSuchElementException;
    class Iterator<E> implements java.util.Iterator<E>, ModificationListener {
        private ModificationEventGenerator parent;
        protected Position<E> start, end, current, next;
        private boolean started, hasNext, hasNextCalculated, terminatedExternally;
        public Iterator(ModificationEventGenerator parent, Position<E> start, Position<E> end) {
            this.parent = parent;
            parent.addModificationListener(this);
            this.start = start;
            this.end = end;
            current = null;
            next = start;
        public boolean hasNext() {
            checkTerminatedExternally();
            if (!hasNextCalculated) {
                hasNext = !(start == null || (started && (next == null || next == end)));
                hasNextCalculated = true;
            if (!hasNext)
                terminate();
            return hasNext;
        public E next() {
            return nextPosition().element();
        protected Position<E> nextPosition() {
            checkTerminatedExternally();
            if (!hasNext())
                throw new NoSuchElementException();
            started = true;
            hasNextCalculated = false;
            next = (current = next).next;
            return current;
        protected Position<E> currentPosition() {
            return current;
        public void remove() {
            throw new UnsupportedOperationException();
        public void modified(ModificationEvent e) throws ConcurrentModificationException {
            if (e.getSource() == parent)
                throw new ConcurrentModificationException();
        public void terminate() {
            terminate(true);
        private void terminate(boolean externally) {
            checkTerminatedExternally();
            parent.removeModificationListener(this);
            if (externally)
                terminatedExternally = true;
        private void checkTerminatedExternally() {
            if (terminatedExternally)
                throw new UnsupportedOperationException("It is not possible to use an iterator that has been terminated.");
    }==========================================================================================
    import java.util.Iterator;
    public class Position<E> {
        private E element;
        protected Position prev = this, next = this;
        public Position(E element) {
            this.element = element;
        public Position(E element, Position prev, Position next) {
            this(element);
            this.prev = prev;
            this.next = next;
        public E element() {
            return element;
        public String toString() {
            return "[" + prev.element.toString() + "]<[" + element.toString() + "]>[" + next.element.toString() + "] ";
    }==========================================================================================
    import java.util.EventListener;
    public interface ModificationListener extends EventListener {
        public void modified(ModificationEvent e);
    }==========================================================================================
    import java.util.EventObject;
    public class ModificationEvent extends EventObject {
        public ModificationEvent(Object source) {
            super(source);
    }==========================================================================================
    public interface ModificationEventGenerator {
        public void addModificationListener(ModificationListener m);
        public void removeModificationListener(ModificationListener m);
        public void generateModificationEvent();
    }==========================================================================================
    public interface PublicCloneable<T extends PublicCloneable<T>> {
        public T clone();
    }==========================================================================================

    I have changed my tests to call Collections.synchronizedCollection when initialising the collection, but now, although the exceptions no longer occur, hardly any of the elements are being added to the collection! Here is my new test code:
    import java.util.Collection;
    import java.util.Collections;
    public class GeneralTests {
        public static void main(String[] args) {
            Collection<Integer> c = Collections.synchronizedCollection(new LinkedCollection<Integer>());
            for (int i = 0; i < 10; i++) {
                Thread t = new Thread(new Berk(c, i * 10), "Thread " + i);
                t.start();
            System.out.println(c);
        static class Berk implements Runnable {
            private Collection<Integer> c;
            private int i;
            public Berk(Collection<Integer> c, int i) {
                this.c = c;
                this.i = i;
            public void run() {
                for (int i = 0; i < 10; i++)
                    c.add(this.i + i);
    }

  • Kodo enhancer throws ConcurrentModificationException

    Attached is the stacktrace i get during enhancement, inside ant build
    process.
    Kodo suddenly fails on classes that were enhanced correctly before, so I
    guess its some internal bug.
    Does anyone know why it happens?
    raczer.
    I use:
    - kodo 2.4.0
    - ant 1.5.1
    begin 666 stacktrace.txt
    M6RXN+ET-"B @(" @6VID;V-=(&IA=F$N=71I;"Y#;VYC=7)R96YT36]D:69I
    M8V%T:6]N17AC97!T:6]N#0H@(" @(%MJ9&]C72 @(" @870@:F%V82YU=&EL
    M+E1R965-87 D16YT<GE)=&5R871O<BYN97AT16YT<GDH5')E94UA<"YJ879A
    M.C$P,C(I#0H@(" @(%MJ9&]C72 @(" @870@:F%V82YU=&EL+E1R965-87 D
    M2V5Y271E<F%T;W(N;F5X="A4<F5E36%P+FIA=F$Z,3 T-RD-"B @(" @6VID
    M;V-=(" @("!A="!C;VTN<V]L87)M971R:6,N:V]D;RYM971A+D-L87-S365T
    M841A=&$N9FEN:7-H*$-L87-S365T841A=&$N:F%V83HS-#4I#0H@(" @(%MJ
    M9&]C72 @(" @870@8V]M+G-O;&%R;65T<FEC+FMO9&\N;65T82Y#;&%S<TUE
    M=&%$871A+FYE=TEN<W1A;F-E*$-L87-S365T841A=&$N:F%V83HR-C@I#0H@
    M(" @(%MJ9&]C72 @(" @870@8V]M+G-O;&%R;65T<FEC+FMO9&\N;65T82Y#
    M;&%S<TUE=&%$871A+F=E=$EN<W1A;F-E*$-L87-S365T841A=&$N:F%V83HQ
    M.3(I#0H@(" @(%MJ9&]C72 @(" @870@8V]M+G-O;&%R;65T<FEC+FMO9&\N
    M;65T82Y#;&%S<TUE=&%$871A+G9A;&ED871E4W5P97)C;&%S<RA#;&%S<TUE
    M=&%$871A+FIA=F$Z-#0V*0T*(" @("!;:F1O8UT@(" @(&%T(&-O;2YS;VQA
    M<FUE=')I8RYK;V1O+FUE=&$N0VQA<W--971A1&%T82YF:6YI<V@H0VQA<W--
    M971A1&%T82YJ879A.C,S,RD-"B @(" @6VID;V-=(" @("!A="!C;VTN<V]L
    M87)M971R:6,N:V]D;RYM971A+D-L87-S365T841A=&$N;F5W26YS=&%N8V4H
    M0VQA<W--971A1&%T82YJ879A.C(V."D-"B @(" @6VID;V-=(" @("!A="!C
    M;VTN<V]L87)M971R:6,N:V]D;RYM971A+D-L87-S365T841A=&$N9V5T26YS
    M=&%N8V4H0VQA<W--971A1&%T82YJ879A.C$Y,BD-"B @(" @6VID;V-=(" @
    M("!A="!C;VTN<V]L87)M971R:6,N:V]D;RYE;FAA;F-E+DI$3T5N:&%N8V5R
    M+CQI;FET/BA*1$]%;FAA;F-E<BYJ879A.C(R-"D-"B @(" @6VID;V-=(" @
    M("!A="!C;VTN<V]L87)M971R:6,N:V]D;RYE;FAA;F-E+DI$3T5N:&%N8V5R
    M+F5N:&%N8V4H2D1/16YH86YC97(N:F%V83HQ.#<I#0H@(" @(%MJ9&]C72 @
    M(" @870@8V]M+G-O;&%R;65T<FEC+FMO9&\N96YH86YC92Y*1$]%;FAA;F-E
    M<BYE;FAA;F-E*$I$3T5N:&%N8V5R+FIA=F$Z,3,U*0T*(" @("!;:F1O8UT@
    M(" @(&%T(&-O;2YS;VQA<FUE=')I8RYM;V1U;&5S+FEN=&5G<F%T:6]N+F%N
    M="Y*1$]%;FAA;F-E<E1A<VLN97AE8W5T94]N*$I$3T5N:&%N8V5R5&%S:RYJ
    M879A.C0S*0T*(" @("!;:F1O8UT@(" @(&%T(&-O;2YS;VQA<FUE=')I8RYM
    M;V1U;&5S+FEN=&5G<F%T:6]N+F%N="Y487-K0F%S92YE>&5C=71E*%1A<VM"
    M87-E+FIA=F$Z,3$X*0T*(" @("!;:F1O8UT@(" @(&%T(&]R9RYA<&%C:&4N
    M=&]O;',N86YT+E5N:VYO=VY%;&5M96YT+F5X96-U=&4H56YK;F]W;D5L96UE
    M;G0N:F%V83HQ-C8I#0H@(" @(%MJ9&]C72 @(" @870@;W)G+F%P86-H92YT
    M;V]L<RYA;G0N5&%S:RYP97)F;W)M*%1A<VLN:F%V83HS,3DI#0H@(" @(%MJ
    M9&]C72 @(" @870@;W)G+F%P86-H92YT;V]L<RYA;G0N5&%R9V5T+F5X96-U
    M=&4H5&%R9V5T+FIA=F$Z,S Y*0T*(" @("!;:F1O8UT@(" @(&%T(&]R9RYA
    M<&%C:&4N=&]O;',N86YT+E1A<F=E="YP97)F;W)M5&%S:W,H5&%R9V5T+FIA
    M=F$Z,S,V*0T*(" @("!;:F1O8UT@(" @(&%T(&]R9RYA<&%C:&4N=&]O;',N
    M86YT+E!R;VIE8W0N97AE8W5T951A<F=E="A0<F]J96-T+FIA=F$Z,3,P-BD-
    M"B @(" @6VID;V-=(" @("!A="!O<F<N87!A8VAE+G1O;VQS+F%N="Y0<F]J
    M96-T+F5X96-U=&5487)G971S*%!R;VIE8W0N:F%V83HQ,C4P*0T*(" @("!;
    M:F1O8UT@(" @(&%T(&]R9RYA<&%C:&4N=&]O;',N86YT+DUA:6XN<G5N0G5I
    M;&0H36%I;BYJ879A.C8Q,"D-"B @(" @6VID;V-=(" @("!A="!O<F<N87!A
    M8VAE+G1O;VQS+F%N="Y-86EN+G-T87)T*$UA:6XN:F%V83HQ.38I#0H@(" @
    M(%MJ9&]C72 @(" @870@;W)G+F%P86-H92YT;V]L<RYA;G0N36%I;BYM86EN
    H*$UA:6XN:F%V83HR,S4I#0H-"D)524Q$($9!24Q%1 T*6RXN+ET-"@``
    `
    end

    This sounds like a manifestation of
    http://bugzilla.solarmetric.com/show_bug.cgi?id=472 to me. Do you have
    circular dependencies between classes defined in multiple metadata
    files? For example, do you have a class Foo whose metadata is defined in
    Foo.jdo, and a class Bar whose metadata is in Bar.jdo, and do Foo and
    Bar have references to each other?
    If this is the bug, the only current workaround is to put those classes
    that have circular references into the same metadata file (a package.jdo
    file or a system.jdo file).
    -Patrick
    Rafa__ Czerwi__ski wrote:
    Attached is the stacktrace i get during enhancement, inside ant build
    process.
    Kodo suddenly fails on classes that were enhanced correctly before, so I
    guess its some internal bug.
    Does anyone know why it happens?
    raczer.
    I use:
    - kodo 2.4.0
    - ant 1.5.1
    [jdoc] java.util.ConcurrentModificationException
    [jdoc] at
    java.util.TreeMap$EntryIterator.nextEntry(TreeMap.java:1022)
    [jdoc] at java.util.TreeMap$KeyIterator.next(TreeMap.java:1047)
    [jdoc] at
    com.solarmetric.kodo.meta.ClassMetaData.finish(ClassMetaData.java:345)
    [jdoc] at
    com.solarmetric.kodo.meta.ClassMetaData.newInstance(ClassMetaData.java:268)
    [jdoc] at
    com.solarmetric.kodo.meta.ClassMetaData.getInstance(ClassMetaData.java:192)
    [jdoc] at
    com.solarmetric.kodo.meta.ClassMetaData.validateSuperclass(ClassMetaData.java:446)
    [jdoc] at
    com.solarmetric.kodo.meta.ClassMetaData.finish(ClassMetaData.java:333)
    [jdoc] at
    com.solarmetric.kodo.meta.ClassMetaData.newInstance(ClassMetaData.java:268)
    [jdoc] at
    com.solarmetric.kodo.meta.ClassMetaData.getInstance(ClassMetaData.java:192)
    [jdoc] at
    com.solarmetric.kodo.enhance.JDOEnhancer.(JDOEnhancer.java:224)
    [jdoc] at
    com.solarmetric.kodo.enhance.JDOEnhancer.enhance(JDOEnhancer.java:187)
    [jdoc] at
    com.solarmetric.kodo.enhance.JDOEnhancer.enhance(JDOEnhancer.java:135)
    [jdoc] at
    com.solarmetric.modules.integration.ant.JDOEnhancerTask.executeOn(JDOEnhancerTask.java:43)
    [jdoc] at
    com.solarmetric.modules.integration.ant.TaskBase.execute(TaskBase.java:118)
    [jdoc] at
    org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:166)
    [jdoc] at org.apache.tools.ant.Task.perform(Task.java:319)
    [jdoc] at org.apache.tools.ant.Target.execute(Target.java:309)
    [jdoc] at
    org.apache.tools.ant.Target.performTasks(Target.java:336)
    [jdoc] at
    org.apache.tools.ant.Project.executeTarget(Project.java:1306)
    [jdoc] at
    org.apache.tools.ant.Project.executeTargets(Project.java:1250)
    [jdoc] at org.apache.tools.ant.Main.runBuild(Main.java:610)
    [jdoc] at org.apache.tools.ant.Main.start(Main.java:196)
    [jdoc] at org.apache.tools.ant.Main.main(Main.java:235)
    BUILD FAILED
    Patrick Linskey [email protected]
    SolarMetric Inc. http://www.solarmetric.com

Maybe you are looking for