linux tomcat jdk7
原文https://blog.youkuaiyun.com/wangjun5159/article/details/50617606#commentBox
解决办法
移除catalina.sh中的-XX:+AggressiveOpts
比如,linux中的catalina.sh
- #2 JAVA_OPTS="-server -Xms1400M -Xmx1400M -Xss512k -XX:+AggressiveOpts -XX:+UseBiasedLocking -XX:PermSize=128M -XX:MaxPermSize=256M -XX:+DisableExplicitGC -XX:MaxTenuringThreshold=31 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -Djava.awt.headless=true "
更深层次的原因
这是个jdk的bug,添加-XX:+AggressiveOpts后,alt-rt.jar在rt.jar之前加载,这会导致map集合有不同的实现(implementation)。
- It seems if you use -XX:+AggressiveOpts then alt-rt.jar is loaded in the classpath earlier than rt.jar. This results in a different implementation of the Map collections.
- Recreate by starting the server with jvm option -XX:+AggressiveOpts. See arguments.cpp and altclasses/java/util/TreeMap.java in in the jdk6 source tree.
- Workaround by removing -XX:+AggressiveOpts.