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

2863 ワード

例外情報
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のバグです.-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