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

Unable to create proxy for large class

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.4.0.Final
    • Fix Version/s: 2.4.1.Final, 3.0.0.Beta1
    • Component/s: Proxies
    • Labels:
      None
    • Environment:

      Windows 7 64-Bit
      java version "1.8.0_102"
      Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

      Description

      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.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                chschroe Christian Schröder
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: