ConcurrentModificationException and duplicate class definition
Robert Marcano
robert at marcanoonline.com
Mon Feb 15 14:24:36 UTC 2016
Greetings. I am trying to narrow down a bug I experience only when using
icedtea-web JNLP implementation. It doesn't happen with closed source
Oracle implementation. I am using Weld (CDI on a SE environment). When
using default Weld configuration it do concurrent bean deployment and I get:
java.lang.LinkageError: loader (instance of
net/sourceforge/jnlp/runtime/JNLPClassLoader): attempted duplicate
class definition for name: "com/...../ClassName" [1]
At first I thought it was some kind on Weld bug with concurrency. I
disabled concurrent deployment with a Weld configuration property. Then
I get java.util.ConcurrentModificationException [2] inside
JNLPClassLoader. Weld without concurrency doesn't mean the applications
is not concurrent. I start Weld initialization on a separate thread
meanwhile the login screen is shown and the user is typing the
credentials, This reduce the startup time of the application for a few
seconds.
I have seen a few concurrency related old fixed bugs for icedtea-web. It
does looks to me like another one. Any hints?
[1] When Weld concurrency is enabled
> org.jboss.weld.exceptions.DeploymentException: loader (instance of net/sourceforge/jnlp/runtime/JNLPClassLoader): attempted duplicate class definition for name: "com/.../Classname"
> at org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:66)
> at org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:43)
> at org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:51)
> at org.jboss.weld.bootstrap.ConcurrentBeanDeployer.addClasses(ConcurrentBeanDeployer.java:62)
> at org.jboss.weld.bootstrap.BeanDeployment.createClasses(BeanDeployment.java:209)
> at org.jboss.weld.bootstrap.WeldStartup.startInitialization(WeldStartup.java:366)
> at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:76)
> at org.jboss.weld.environment.se.Weld.initialize(Weld.java:149)
> at com.....WeldInitializer.run(Unknown Source)
> Caused by: java.lang.LinkageError: loader (instance of net/sourceforge/jnlp/runtime/JNLPClassLoader): attempted duplicate class definition for name: "com/.../Classname"
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
> at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> at net.sourceforge.jnlp.runtime.JNLPClassLoader.access$1601(JNLPClassLoader.java:106)
> at net.sourceforge.jnlp.runtime.JNLPClassLoader$5.run(JNLPClassLoader.java:1800)
> at net.sourceforge.jnlp.runtime.JNLPClassLoader$5.run(JNLPClassLoader.java:1798)
> at java.security.AccessController.doPrivileged(Native Method)
> at net.sourceforge.jnlp.runtime.JNLPClassLoader.findClass(JNLPClassLoader.java:1797)
> at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClassExt(JNLPClassLoader.java:1834)
> at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClass(JNLPClassLoader.java:1624)
> at org.jboss.weld.environment.deployment.discovery.jandex.JandexClassFileInfo.loadClass(JandexClassFileInfo.java:281)
> at org.jboss.weld.environment.deployment.discovery.jandex.JandexClassFileInfo.isAssignableTo(JandexClassFileInfo.java:225)
> at org.jboss.weld.environment.deployment.discovery.jandex.JandexClassFileInfo.isAssignableTo(JandexClassFileInfo.java:231)
> at org.jboss.weld.environment.deployment.discovery.jandex.JandexClassFileInfo.isAssignableTo(JandexClassFileInfo.java:101)
> at org.jboss.weld.util.Beans.isTypeManagedBeanOrDecoratorOrInterceptor(Beans.java:519)
> at org.jboss.weld.bootstrap.FastAnnotatedTypeLoader.loadAnnotatedType(FastAnnotatedTypeLoader.java:83)
> at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:97)
> at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:65)
> at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:62)
> at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
> at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
> at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:744)
[2] when Weld concurrency is disabled
> Caused by: java.util.ConcurrentModificationException
> at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
> at java.util.ArrayList$Itr.next(ArrayList.java:851)
> at net.sourceforge.jnlp.runtime.JNLPClassLoader.getPermissions(JNLPClassLoader.java:1180)
> at java.security.SecureClassLoader.getProtectionDomain(SecureClassLoader.java:206)
> at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
> at net.sourceforge.jnlp.runtime.JNLPClassLoader.access$1701(JNLPClassLoader.java:103)
> at net.sourceforge.jnlp.runtime.JNLPClassLoader$5.run(JNLPClassLoader.java:1666)
> at net.sourceforge.jnlp.runtime.JNLPClassLoader$5.run(JNLPClassLoader.java:1663)
> at java.security.AccessController.doPrivileged(Native Method)
> at net.sourceforge.jnlp.runtime.JNLPClassLoader.findClass(JNLPClassLoader.java:1662)
> at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClassExt(JNLPClassLoader.java:1699)
> at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClass(JNLPClassLoader.java:1498)
> at java.lang.Class.getDeclaredFields0(Native Method)
> at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
> at java.lang.Class.getDeclaredFields(Class.java:1916)
> at org.jboss.weld.security.GetDeclaredFieldsAction.run(GetDeclaredFieldsAction.java:30)
> at org.jboss.weld.security.GetDeclaredFieldsAction.run(GetDeclaredFieldsAction.java:22)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.jboss.weld.annotated.slim.backed.SecurityActions.getDeclaredFields(SecurityActions.java:47)
> at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedFields.computeValue(BackedAnnotatedType.java:179)
> at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedFields.computeValue(BackedAnnotatedType.java:173)
> at org.jboss.weld.util.LazyValueHolder.get(LazyValueHolder.java:35)
> at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$EagerlyInitializedLazyValueHolder.<init>(BackedAnnotatedType.java:156)
> at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedFields.<init>(BackedAnnotatedType.java:173)
> at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedFields.<init>(BackedAnnotatedType.java:173)
> at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.<init>(BackedAnnotatedType.java:62)
> at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.of(BackedAnnotatedType.java:44)
> at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.load(ClassTransformer.java:83)
> at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.load(ClassTransformer.java:80)
> at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
> at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
> at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
> at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
> at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
> at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
> at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
> at org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:49)
> at org.jboss.weld.util.cache.LoadingCacheUtils.getCastCacheValue(LoadingCacheUtils.java:74)
> at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:175)
> at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:194)
> at org.jboss.weld.bootstrap.FastAnnotatedTypeLoader.loadAnnotatedType(FastAnnotatedTypeLoader.java:109)
> at org.jboss.weld.bootstrap.FastAnnotatedTypeLoader.createContext(FastAnnotatedTypeLoader.java:98)
> at org.jboss.weld.bootstrap.FastAnnotatedTypeLoader.loadAnnotatedType(FastAnnotatedTypeLoader.java:87)
> at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:97)
> at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:135)
> at org.jboss.weld.bootstrap.BeanDeployment.createClasses(BeanDeployment.java:203)
> at org.jboss.weld.bootstrap.WeldStartup.startInitialization(WeldStartup.java:375)
> at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:76)
> at org.jboss.weld.environment.se.Weld.initialize(Weld.java:556)
More information about the distro-pkg-dev
mailing list