jenkins Hudson fails build with UnsupportedOperationException due to attempted modification of Simpl

异常信息

java.lang.UnsupportedOperationException
at java.util.AbstractMap$SimpleImmutableEntry.setValue(AbstractMap.java:726)
at hudson.EnvVars.resolve(EnvVars.java:156)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:689)
at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:128)
at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:384)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416)
at hudson.model.Run.run(Run.java:1243)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:304)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:122)
project=hudson.maven.MavenModuleSet@33c36633[TEL Parent]
project.getModules()=[hudson.maven.MavenModule@341840ff[TEL Parent/org.theeuropeanlibrary:parent], hudson.maven.MavenModule@16692a88[TEL Parent/org.theeuropeanlibrary:tel-parent]]
project.getRootModule()=hudson.maven.MavenModule@16692a88[TEL Parent/org.theeuropeanlibrary:tel-parent]
FATAL: null
java.lang.UnsupportedOperationException
at java.util.AbstractMap$SimpleImmutableEntry.setValue(AbstractMap.java:726)
at hudson.EnvVars.resolve(EnvVars.java:156)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:689)
at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:128)
at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:384)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416)
at hudson.model.Run.run(Run.java:1243)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:304)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:122)

解决办法

移除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.


参考

jenkins bug

你可能感兴趣的:(jenkins Hudson fails build with UnsupportedOperationException due to attempted modification of Simpl)