我正面临这个奇怪的问题,其中 api 由于 javax.validation 问题而引发并发修改异常。
java.util.ConcurrentModificationException: null
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1445) ~[na:1.8.0_265]
at java.util.HashMap$ValueIterator.next(HashMap.java:1474) ~[na:1.8.0_265]
at org.eclipse.persistence.jpa.PersistenceProvider.isLoadedWithReference(PersistenceProvider.java:464) ~[eclipselink-2.6.1.jar:2.6.1.v20150916-55dc7c3]
at javax.persistence.Persistence$PersistenceUtilImpl.isLoaded(Persistence.java:154) ~[javax.persistence-2.1.0.jar:2.1.0]
at org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:56) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:130) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.java:46) ~[bean-validator-2.2.0.jar:5.0.0.Final] [1 skipped]
at org.hibernate.validator.internal.engine.ValidatorImpl.isReachable(ValidatorImpl.java:1307) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:1292) ~[bean-validator-2.2.0.jar:5.0.0.Final]
... 49 common frames omitted
Wrapped by: javax.validation.ValidationException: HV000041: Call to TraversableResolver.isReachable() threw an exception.
at org.hibernate.validator.internal.engine.ValidatorImpl.isReachable(ValidatorImpl.java:1316) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:1292) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:475) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:424) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:388) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:340) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraint(ValidatorImpl.java:635) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraints(ValidatorImpl.java:524) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:349) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraint(ValidatorImpl.java:635) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraints(ValidatorImpl.java:524) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateParametersInContext(ValidatorImpl.java:916) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateParameters(ValidatorImpl.java:240) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateParameters(ValidatorImpl.java:198) ~[bean-validator-2.2.0.jar:5.0.0.Final]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095) [webapp-runner.jar:na] [28 skipped]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) [webapp-runner.jar:na]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502) [webapp-runner.jar:na]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458) [webapp-runner.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_265]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_265]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [webapp-runner.jar:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_265]
堆栈跟踪没有说明 bean 中的哪个验证导致了问题。