Weld 2.1.0 Final fails to create proxies on Swing derived classes
lstreepy Nov 8, 2013 4:00 PMI'm trying to use weld SE in a standard desktop app, and I've created a couple of Interceptors to ensure that certain methods are called on the EDT.
An example of one of my annotations:
@InterceptorBinding
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface InvokeOnEDT
{
}
And the actual interceptor:
@InvokeOnEDT
@Interceptor
@Priority(1)
public class InvokeOnEDTInterceptor
{
private static final Logger logger = Logger.getLogger(InvokeOnEDTInterceptor.class);
@AroundInvoke
public Object ensureOnEDT(InvocationContext ctx) throws Exception
{
logger.warn("INV intercepted: " + ctx);
return ctx.proceed();
}
}
When I try to initialize the weld container, I get the following exception on any class that uses this annotation on a method and extends a swing component (JPanel is the primary offender):
org.jboss.weld.exceptions.WeldException: WELD-001524: Unable to load proxy class for bean Managed Bean [class xxxx.xxxx.core.view.gui.maptools.ShapeEditorPanel3D] with qualifiers [@Any @Default] with
class class xxx.xxxx.core.view.gui.maptools.ShapeEditorPanel3D using classloader sun.misc.Launcher$AppClassLoader@6c5bdfae
at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:315)
at org.jboss.weld.injection.producer.SubclassedComponentInstantiator.createEnhancedSubclass(SubclassedComponentInstantiator.java:83)
at org.jboss.weld.injection.producer.SubclassedComponentInstantiator.initEnhancedSubclass(SubclassedComponentInstantiator.java:65)
at org.jboss.weld.injection.producer.SubclassedComponentInstantiator.<init>(SubclassedComponentInstantiator.java:58)
at org.jboss.weld.injection.producer.SubclassedComponentInstantiator.<init>(SubclassedComponentInstantiator.java:54)
at org.jboss.weld.injection.producer.BeanInjectionTarget.initializeAfterBeanDiscovery(BeanInjectionTarget.java:127)
at org.jboss.weld.injection.producer.InjectionTargetInitializationContext.initialize(InjectionTargetInitializationContext.java:42)
at org.jboss.weld.injection.producer.InjectionTargetService.initialize(InjectionTargetService.java:58)
at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:413)
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:76)
at org.jboss.weld.bootstrap.api.helpers.ForwardingBootstrap.deployBeans(ForwardingBootstrap.java:63)
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:143)
at XXXXLauncher.main(XXXXLauncher.java:137)
Caused by: java.lang.RuntimeException: java.lang.IllegalAccessError: class xxx.xxxx.core.view.gui.maptools.ShapeEditorPanel3D$Proxy$_$$_WeldSubclass cannot access its superinterface javax.swing.TransferHandler$HasGetTransferHandler
at org.jboss.weld.util.bytecode.ClassFileUtils.toClass(ClassFileUtils.java:101)
at org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:423)
at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:308)
... 12 more
Caused by: java.lang.IllegalAccessError: class xxx.xxxx.core.view.gui.maptools.ShapeEditorPanel3D$Proxy$_$$_WeldSubclass cannot access its superinterface javax.swing.TransferHandler$HasGetTransferHandler
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
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:601)
at org.jboss.weld.util.bytecode.ClassFileUtils.toClass2(ClassFileUtils.java:108)
at org.jboss.weld.util.bytecode.ClassFileUtils.toClass(ClassFileUtils.java:97)
... 14 more
This happens on any class that derives from something like JPanel. This seems like a bug to me, but I found almost nothing googling for this except some several year old posts about spring AOP.
Any suggestions? Bug?
Thanks,
Larry.