Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2244

Unable to create proxy for large class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.4.1.Final, 3.0.0.Beta1
    • 2.4.0.Final
    • Proxies
    • None

      When a proxy is created while decorating a bean with many methods, a WELD-001524 error is thrown with the following stack trace:

      Exception in thread "main" org.jboss.weld.exceptions.WeldException: WELD-001524: Unable to load proxy class for bean Managed Bean [class com.solvians.test.TestClass2] with qualifiers [@Any @Default] with class class com.solvians.test.TestClass2 using classloader sun.misc.Launcher$AppClassLoader@5c647e05
      	at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:379)
      	at org.jboss.weld.injection.producer.SubclassedComponentInstantiator.createEnhancedSubclass(SubclassedComponentInstantiator.java:114)
      	at org.jboss.weld.injection.producer.SubclassedComponentInstantiator.initEnhancedSubclass(SubclassedComponentInstantiator.java:86)
      	at org.jboss.weld.injection.producer.SubclassedComponentInstantiator.<init>(SubclassedComponentInstantiator.java:79)
      	at org.jboss.weld.injection.producer.SubclassedComponentInstantiator.forInterceptedDecoratedBean(SubclassedComponentInstantiator.java:63)
      	at org.jboss.weld.injection.producer.BeanInjectionTarget.initializeAfterBeanDiscovery(BeanInjectionTarget.java:121)
      	at org.jboss.weld.injection.producer.InjectionTargetInitializationContext.initialize(InjectionTargetInitializationContext.java:42)
      	at org.jboss.weld.injection.producer.InjectionTargetService.initialize(InjectionTargetService.java:63)
      	at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:442)
      	at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83)
      	at org.jboss.weld.environment.se.Weld.initialize(Weld.java:607)
      	at org.jboss.weld.environment.se.StartMain.go(StartMain.java:44)
      	at org.jboss.weld.environment.se.StartMain.main(StartMain.java:53)
      Caused by: java.lang.RuntimeException: java.lang.ClassFormatError: Invalid method Code length 85013 in class file com/solvians/test/TestClass2$Proxy$_$$_WeldSubclass
      	at org.jboss.weld.util.bytecode.ClassFileUtils.toClass(ClassFileUtils.java:101)
      	at org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:490)
      	at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:372)
      	... 12 more
      Caused by: java.lang.ClassFormatError: Invalid method Code length 85013 in class file com/solvians/test/TestClass2$Proxy$_$$_WeldSubclass
      	at java.lang.ClassLoader.defineClass1(Native Method)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.jboss.weld.util.bytecode.ClassFileUtils.toClass2(ClassFileUtils.java:108)
      	at org.jboss.weld.util.bytecode.ClassFileUtils.toClass(ClassFileUtils.java:97)
      	... 14 more
      

      In my original application, I tried to manually create a bean from an unmanaged class which is auto-generated and thus contains many methods. The bean is decorated, so a proxy needs to be created, which caused that error.

              Unassigned Unassigned
              chschroe Christian Schröder (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: