Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.5.1
-
None
-
Weld 2.3.1.Final, Oracle JVM 1.7.0_79
Description
When starting a CDI container multiple times (e.g. during execution of multiple tests), the class generator used by the PartialBean module tries to redefine an already generating class, causing java.lang.LinkageError. This could be simply reproduces by having the partial bean module with an partial bean definition in the classpath and (re-)starting the CdiContainer a second time:
public class Main { public static void main(String[] args) { CdiContainer container = CdiContainerLoader.getCdiContainer(); container.boot(); container.shutdown(); container.boot(); } }
Exception in thread "main" org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions: Exception 0 : java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at org.apache.deltaspike.proxy.impl.AsmProxyClassGenerator.loadClass(AsmProxyClassGenerator.java:465) at org.apache.deltaspike.proxy.impl.AsmProxyClassGenerator.generateProxyClass(AsmProxyClassGenerator.java:66) at org.apache.deltaspike.proxy.api.DeltaSpikeProxyFactory.createProxyClass(DeltaSpikeProxyFactory.java:125) at org.apache.deltaspike.proxy.api.DeltaSpikeProxyFactory.getProxyClass(DeltaSpikeProxyFactory.java:88) at org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle.<init>(DeltaSpikeProxyContextualLifecycle.java:62) at org.apache.deltaspike.partialbean.impl.PartialBeanBindingExtension.createPartialBean(PartialBeanBindingExtension.java:186) at org.apache.deltaspike.partialbean.impl.PartialBeanBindingExtension.createBeans(PartialBeanBindingExtension.java:150) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88) at org.jboss.weld.injection.MethodInvocationStrategy$SpecialParamPlusBeanManagerStrategy.invoke(MethodInvocationStrategy.java:144) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:309) at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:124) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:287) at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:265) at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:271) at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:260) at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:154) at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:148) at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:53) at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:42) at org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:61) at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:423) at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83) at org.jboss.weld.environment.se.Weld.initialize(Weld.java:557) at org.apache.deltaspike.cdise.weld.WeldContainerControl.boot(WeldContainerControl.java:68) at kn.gvs.shipmentoperating.Main.main(Main.java:12) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.deltaspike.proxy.impl.AsmProxyClassGenerator.loadClass(AsmProxyClassGenerator.java:452) ... 28 more Caused by: java.lang.LinkageError: loader (instance of sun/misc/Launcher$AppClassLoader): attempted duplicate class definition for name: "kn/gvs/shipmentoperating/dashboard/ui/controller/ShipmentTaskController/Factory$$DSPartialBeanProxy" at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) ... 32 more at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:44) at org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:61) at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:423) at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83) at org.jboss.weld.environment.se.Weld.initialize(Weld.java:557) at org.apache.deltaspike.cdise.weld.WeldContainerControl.boot(WeldContainerControl.java:68)