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 1.4.2_02. WARNING: Error registering contexts java.util.ConcurrentModificationException 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 (DefaultMBeanRepository.java:56) at mx4j.server.MBeanServerImpl.findMBeansByPattern (MBeanServerImpl.java:1603) at mx4j.server.MBeanServerImpl.queryObjectNames (MBeanServerImpl.java:1568) at mx4j.server.MBeanServerImpl.queryMBeans(MBeanServerImpl.java:1512) at org.apache.coyote.tomcat5.MapperListener.init (MapperListener.java:126) at org.apache.coyote.tomcat5.CoyoteConnector.start (CoyoteConnector.java:1510) at org.apache.catalina.core.StandardService.start (StandardService.java:485) at org.apache.catalina.core.StandardServer.start (StandardServer.java:2298) at org.apache.catalina.startup.Catalina.start(Catalina.java:556) 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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
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 ***
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 fail. Will this be resolved in 5.0.25? Or is the only option for me changing to the Sun RI?
Please do not reopen the report. Please reread my answer, everything is there. *** This bug has been marked as a duplicate of 22388 ***
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.
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.
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 http://java.sun.com/products/JavaManagement/download.html 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.
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.
Confirmed that comment #6 resolves the issue. What version of tomcat can we expect this fix included in?
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. Peter
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.