Bug 29056 - java.util.ConcurrentModificationException
Summary: java.util.ConcurrentModificationException
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 5.0.24
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2004-05-18 06:32 UTC by Petteri Stenius
Modified: 2005-02-18 06:16 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Petteri Stenius 2004-05-18 06:32:37 UTC
I sometimes see ConcurrentModificationException during Tomcat startup.

This issue was previously reported as #22388 for TC 5.0.7. The issue was 
marked as resolved! Any instructions how to work around this startup problem? 

Tomcat was installed from jakarta-tomcat-5.0.24.zip, the host is running J2SE 

WARNING: Error registering contexts
        at java.util.HashMap$HashIterator.nextEntry(HashMap.java:782)
        at java.util.HashMap$EntryIterator.next(HashMap.java:824)
        at java.util.HashMap.putAllForCreate(HashMap.java:424)
        at java.util.HashMap.clone(HashMap.java:656)
        at mx4j.server.DefaultMBeanRepository.clone
        at mx4j.server.MBeanServerImpl.findMBeansByPattern
        at mx4j.server.MBeanServerImpl.queryObjectNames
        at mx4j.server.MBeanServerImpl.queryMBeans(MBeanServerImpl.java:1512)
        at org.apache.coyote.tomcat5.MapperListener.init
        at org.apache.coyote.tomcat5.CoyoteConnector.start
        at org.apache.catalina.core.StandardService.start
        at org.apache.catalina.core.StandardServer.start
        at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
Comment 1 Remy Maucherat 2004-05-18 06:36:56 UTC
This is an issue with the MX4J release we're using. Start TC again (it happens
rarely, so it should be ok), or replace the MX4J impl with the Sun RI (which
doesn't have the issue and has been used for all previous 5.0.x stable releases,
but that we can't bundle anymore due to the new ASF licensing policies).

*** This bug has been marked as a duplicate of 22388 ***
Comment 2 Dave McDonnell 2004-05-19 06:09:00 UTC
I just upgraded to 5.0.24 and I'm getting this every time I start the server.

The server config has 3 Services, each with an Engine. The first 
Service/Engine has 3 Hosts, while the other two Service/Engine only have 1 
Host each.

The first Service/Engine seems to start up correctly, while the second two 

Will this be resolved in 5.0.25? Or is the only option for me changing to the 
Sun RI?
Comment 3 Remy Maucherat 2004-05-19 07:25:23 UTC
Please do not reopen the report. Please reread my answer, everything is there.

*** This bug has been marked as a duplicate of 22388 ***
Comment 4 Dave McDonnell 2004-05-25 02:46:11 UTC
Upon further investigation I found my config file (brought forward from TC4) 
was explicitly referring to the connector class:

<Connector  className="org.apache.coyote.tomcat4.CoyoteConnector" ...>

Removing this has resolved the issue.
Comment 5 Adam Rabung 2004-06-14 15:50:10 UTC
This appears to be fixed by commenting out the entire 
<mbean name="CoyoteConnector"> element in
<TOMCAT_HOME>server\classes\org\apache\catalina\mbeans.  As far as I can tell,
it does not cause any new problems.
Comment 6 Adam Rabung 2004-06-18 18:34:25 UTC
My previous advice was wrong - that file is not included in default Tomcat
builds (and bizarrely it only fixed the problem for a few days).  
However, using Sun's RI definitely seems to fix it.
1. Download JMX 1.2.1 Reference Implementation from
2. Extract jmxri.jar to overwrite the file <TOMCAT_HOME>/bin/jmx.jar 

This has worked perfectly for me for like a week.

By the way, Jakarta should consider giving this a closer look.  This problem is
NOT rare for me and my team, and the server must be restarted after it happens.
 It also makes me uncomfortable patching a "final" product.  I'm on Tomcat 5.0.29.
Comment 7 Brill Pappin 2005-02-13 20:38:35 UTC
Using 5.0.29

I'm having the same trouble, it's consistant and critical for a production
system. Restarting Tomcat usually doesn't help, and I have to remove all the
webapps in all the virtual hosts before I can get the system back up.

I've just entered my details in a reopened bug (26752), but it looks like I
added to the wrong ticket (I'll close that one again).

I've reopened this bug as it's clearly not resolved, patching a release version
of Tomcat (comment #9) is *not* resolution. If this is fixed in a later release,
let us know.
Comment 8 Brill Pappin 2005-02-13 20:48:25 UTC
Confirmed that comment #6 resolves the issue.
What version of tomcat can we expect this fix included in?
Comment 9 Peter Rossbach 2005-02-13 21:04:06 UTC
Download the news mx4j 2.1.1 http://mx4j.sourceforge.net/
and copy mx4j.jar to your catalina.home/bin. Then delete existing
jmx.jar and move mx4j.jar to jmx.jar.

Comment 10 Yoav Shapira 2005-02-18 15:16:09 UTC
Please read what Remy said about distribution licenses, and Peter's latest 
MX4J suggestion.  5.0.30 includes a later MX4J I think, but 5.5.7 includes it 
for sure, and either way it's an easy swap.