javassist.CannotCompileException: an interface method must be abstract:

GitHub | jose | 6 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    an interface method must be abstract

    GitHub | 6 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 | 6 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

    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