net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null

Spring JIRA | Jan Novotný | 4 years ago
  1. 0

    In 3.2 GA version of the Spring Framework I started to experience LingageErrors with cause of duplicate class definition. For example: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237) at net.sf.cglib.reflect.FastClass$Generator.create(FastClass.java:64) at net.sf.cglib.proxy.MethodProxy.helper(MethodProxy.java:120) at net.sf.cglib.proxy.MethodProxy.init(MethodProxy.java:74) at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:213) at com.fg.metadata.business.aop.SpringCgLibIssue$AbstractMethodInterceptor.intercept(SpringCgLibIssue.java:58) at com.fg.metadata.business.aop.SpringCgLibIssue$TestClassToProxy$$EnhancerByCGLIB$$f3b6125d.getSomeInt(<generated>) at com.fg.metadata.business.aop.SpringCgLibIssue$TestClassToProxy$$FastClassByCGLIB$$4b5eb31.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at com.fg.metadata.business.aop.SpringCgLibIssue$SomeAdvice.invoke(SpringCgLibIssue.java:71) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631) at com.fg.metadata.business.aop.SpringCgLibIssue$TestClassToProxy$$EnhancerByCGLIB$$d3d37a7d.getSomeInt(<generated>) at com.fg.metadata.business.aop.SpringCgLibIssue.testCallMethodOfAbstractClass(SpringCgLibIssue.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.junit3.JUnit3IdeaTestRunner.doRun(JUnit3IdeaTestRunner.java:139) at com.intellij.junit3.JUnit3IdeaTestRunner.startRunnerWithArgs(JUnit3IdeaTestRunner.java:52) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219) ... 36 more Caused by: java.lang.LinkageError: duplicate class definition: com/fg/metadata/business/aop/SpringCgLibIssue$TestClassToProxy$$FastClassByCGLIB$$4b5eb31 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) ... 42 more Problem can be reproduced by the attached TestCase. Problem is quite weird - and is described in the attached test. Only first call to the implemented method of the abstract class ends with this exception, all succeeding calls finish ok. Please don't ask why we are wrapping CgLib proxy into another Spring proxy. We have our reasons that are quite complex to explain. This problem did not occur in previous versions of Spring (we use this mechanism since 2.5 version of Spring). Thanks for help in advance.

    Spring JIRA | 4 years ago | Jan Novotný
    net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
  2. 0

    In 3.2 GA version of the Spring Framework I started to experience LingageErrors with cause of duplicate class definition. For example: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237) at net.sf.cglib.reflect.FastClass$Generator.create(FastClass.java:64) at net.sf.cglib.proxy.MethodProxy.helper(MethodProxy.java:120) at net.sf.cglib.proxy.MethodProxy.init(MethodProxy.java:74) at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:213) at com.fg.metadata.business.aop.SpringCgLibIssue$AbstractMethodInterceptor.intercept(SpringCgLibIssue.java:58) at com.fg.metadata.business.aop.SpringCgLibIssue$TestClassToProxy$$EnhancerByCGLIB$$f3b6125d.getSomeInt(<generated>) at com.fg.metadata.business.aop.SpringCgLibIssue$TestClassToProxy$$FastClassByCGLIB$$4b5eb31.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at com.fg.metadata.business.aop.SpringCgLibIssue$SomeAdvice.invoke(SpringCgLibIssue.java:71) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631) at com.fg.metadata.business.aop.SpringCgLibIssue$TestClassToProxy$$EnhancerByCGLIB$$d3d37a7d.getSomeInt(<generated>) at com.fg.metadata.business.aop.SpringCgLibIssue.testCallMethodOfAbstractClass(SpringCgLibIssue.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.junit3.JUnit3IdeaTestRunner.doRun(JUnit3IdeaTestRunner.java:139) at com.intellij.junit3.JUnit3IdeaTestRunner.startRunnerWithArgs(JUnit3IdeaTestRunner.java:52) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219) ... 36 more Caused by: java.lang.LinkageError: duplicate class definition: com/fg/metadata/business/aop/SpringCgLibIssue$TestClassToProxy$$FastClassByCGLIB$$4b5eb31 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) ... 42 more Problem can be reproduced by the attached TestCase. Problem is quite weird - and is described in the attached test. Only first call to the implemented method of the abstract class ends with this exception, all succeeding calls finish ok. Please don't ask why we are wrapping CgLib proxy into another Spring proxy. We have our reasons that are quite complex to explain. This problem did not occur in previous versions of Spring (we use this mechanism since 2.5 version of Spring). Thanks for help in advance.

    Spring JIRA | 4 years ago | Jan Novotný
    net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
  3. 0

    Weird code generation issue

    GitHub | 4 years ago | codahale
    org.skife.jdbi.net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    BPEL Managed server Error

    Stack Overflow | 4 years ago | Tejas
    java.lang.reflect.InvocationTargetException
  6. 0

    problem with running Servlet on Tomcat: InvocationTargetException

    Stack Overflow | 7 years ago | Fahim
    java.lang.reflect.InvocationTargetException

    2 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.LinkageError

      duplicate class definition: com/fg/metadata/business/aop/SpringCgLibIssue$TestClassToProxy$$FastClassByCGLIB$$4b5eb31

      at java.lang.ClassLoader.defineClass1()
    2. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. java.lang.ClassLoader.defineClass1(Native Method)
      2. java.lang.ClassLoader.defineClass(ClassLoader.java:621)
      3. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      4. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      5. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      5 frames
    3. Code Generation Library
      FastClass$Generator.create
      1. net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
      2. net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
      3. net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
      4. net.sf.cglib.reflect.FastClass$Generator.create(FastClass.java:64)
      4 frames
    4. IDEA
      MethodProxy.invokeSuper
      1. net.sf.cglib.proxy.MethodProxy.helper(MethodProxy.java:120)
      2. net.sf.cglib.proxy.MethodProxy.init(MethodProxy.java:74)
      3. net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:213)
      3 frames
    5. com.fg.metadata
      SpringCgLibIssue$TestClassToProxy$$FastClassByCGLIB$$4b5eb31.invoke
      1. com.fg.metadata.business.aop.SpringCgLibIssue$AbstractMethodInterceptor.intercept(SpringCgLibIssue.java:58)
      2. com.fg.metadata.business.aop.SpringCgLibIssue$TestClassToProxy$$EnhancerByCGLIB$$f3b6125d.getSomeInt(<generated>)
      3. com.fg.metadata.business.aop.SpringCgLibIssue$TestClassToProxy$$FastClassByCGLIB$$4b5eb31.invoke(<generated>)
      3 frames
    6. Spring Core
      MethodProxy.invoke
      1. org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
      1 frame
    7. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
      2 frames
    8. com.fg.metadata
      SpringCgLibIssue$SomeAdvice.invoke
      1. com.fg.metadata.business.aop.SpringCgLibIssue$SomeAdvice.invoke(SpringCgLibIssue.java:71)
      1 frame
    9. Spring AOP
      CglibAopProxy$DynamicAdvisedInterceptor.intercept
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      2. org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
      2 frames
    10. com.fg.metadata
      SpringCgLibIssue.testCallMethodOfAbstractClass
      1. com.fg.metadata.business.aop.SpringCgLibIssue$TestClassToProxy$$EnhancerByCGLIB$$d3d37a7d.getSomeInt(<generated>)
      2. com.fg.metadata.business.aop.SpringCgLibIssue.testCallMethodOfAbstractClass(SpringCgLibIssue.java:37)
      2 frames
    11. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3 frames
    12. com.intellij.junit3
      JUnit3IdeaTestRunner.startRunnerWithArgs
      1. com.intellij.junit3.JUnit3IdeaTestRunner.doRun(JUnit3IdeaTestRunner.java:139)
      2. com.intellij.junit3.JUnit3IdeaTestRunner.startRunnerWithArgs(JUnit3IdeaTestRunner.java:52)
      2 frames
    13. IDEA
      JUnitStarter.main
      1. com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
      2. com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
      2 frames
    14. Java RT
      NativeMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      2 frames
    15. IDEA
      AppMain.main
      1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      1 frame