javassist.CannotCompileException: an interface method must be abstract:

GitHub | jose | 3 months ago
  1. 0

    an interface method must be abstract

    GitHub | 3 months ago | jose
    javassist.CannotCompileException: an interface method must be abstract:
  2. 0

    First of all, thanks for a great work Hibernate is doing! Now, with Hibernate 5.2.2, build time enhancement fails for entities with 2 mapped classes. For given classes: {code} @MappedSuperclass abstract class A { @Id protected Long id; } @MappedSuperclass abstract class B extends A { } @Entity class C extends B { } {code} When doing enhancement using maven plugin 5.2.2 with config: {code} <configuration> <failOnError>true</failOnError> <enableLazyInitialization>true</enableLazyInitialization> <enableDirtyTracking>true</enableDirtyTracking> <enableAssociationManagement>true</enableAssociationManagement> </configuration> {code} failure occurs as follows: {code} org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.hibernate.orm.tooling:hibernate-enhance-maven-plugin:5.2.2.Final:enhance (default) on project ice-model: Unable to enhance class: com.itf.ice2.domain.casefile.common.refdata.RefData at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) at org.apache.maven.cli.MavenCli.main(MavenCli.java:157) 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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to enhance class: com.itf.ice2.domain.casefile.common.refdata.RefData at org.hibernate.orm.tooling.maven.MavenEnhancePlugin.doEnhancement(MavenEnhancePlugin.java:249) at org.hibernate.orm.tooling.maven.MavenEnhancePlugin.execute(MavenEnhancePlugin.java:155) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 19 more Caused by: org.hibernate.bytecode.enhance.spi.EnhancementException: Unable to enhance persistent attribute [com.itf.ice2.domain.casefile.common.refdata.RefData:id] at org.hibernate.bytecode.enhance.internal.PersistentAttributesEnhancer.enhancePersistentAttribute(PersistentAttributesEnhancer.java:126) at org.hibernate.bytecode.enhance.internal.PersistentAttributesEnhancer.enhance(PersistentAttributesEnhancer.java:62) at org.hibernate.bytecode.enhance.internal.MappedSuperclassEnhancer.enhance(MappedSuperclassEnhancer.java:31) at org.hibernate.bytecode.enhance.spi.Enhancer.enhance(Enhancer.java:138) at org.hibernate.bytecode.enhance.spi.Enhancer.enhance(Enhancer.java:73) at org.hibernate.orm.tooling.maven.MavenEnhancePlugin.doEnhancement(MavenEnhancePlugin.java:244) ... 22 more Caused by: org.hibernate.bytecode.enhance.spi.EnhancementException: Could not enhance class [com.itf.ice2.domain.casefile.common.refdata.RefData] to add method [$$_hibernate_read_id] for field [id] at org.hibernate.bytecode.enhance.internal.MethodWriter.addGetter(MethodWriter.java:57) at org.hibernate.bytecode.enhance.internal.MappedSuperclassEnhancer.generateFieldReader(MappedSuperclassEnhancer.java:45) at org.hibernate.bytecode.enhance.internal.PersistentAttributesEnhancer.enhancePersistentAttribute(PersistentAttributesEnhancer.java:116) ... 27 more Caused by: javassist.CannotCompileException: bad declaring class at javassist.CtClassType.addMethod(CtClassType.java:1372) at org.hibernate.bytecode.enhance.internal.MethodWriter.addGetter(MethodWriter.java:52) {code} Making field private solves the problem. Anyway error reported by enhancer is bit unclear.

    Hibernate JIRA | 4 months ago | Piotr Klimczak
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.hibernate.orm.tooling:hibernate-enhance-maven-plugin:5.2.2.Final:enhance (default) on project ice-model: Unable to enhance class: com.itf.ice2.domain.casefile.common.refdata.RefData
  3. 0

    How to avoid 'javassist.CannotCompileException: no method body'

    Stack Overflow | 3 years ago | Duncan
    javassist.CannotCompileException: no method body
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    How to avoid 'javassist.CannotCompileException: no method body'

    Stack Overflow | 3 years ago | Duncan
    javassist.CannotCompileException: no method body
  6. 0

    Problem with mocking Seam Component class

    Google Groups | 7 years ago | Andrey Chernyshev
    java.lang.IllegalStateException: Failed to transform class with name org.jboss.seam.Component. Reason: duplicate method: <init>

    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. javassist.CannotCompileException

      an interface method must be abstract:

      at javassist.CtClassType.addMethod()
    2. Javassist
      CtClassType.addMethod
      1. javassist.CtClassType.addMethod(CtClassType.java:1379)
      1 frame