We're updating the issue view to help you get more done. 

ByteBuddy Enhancer throws java.lang.IllegalStateException: Cannot resolve type description for certain classes

Description

I have assembled a test project that replicates this issue. It seems like the Byte Buddy enhancer manages to enhance some classes, while for others it throw the following exception:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 ERROR: HHH000279: Unable to build enhancement metamodel for PostComment java.lang.IllegalStateException: Cannot resolve type description for com.vladmihalcea.book.hpjp.hibernate.forum.Post at net.bytebuddy.pool.TypePool$Resolution$Illegal.resolve(TypePool.java:149) at net.bytebuddy.pool.TypePool$Default$LazyTypeDescription$TokenizedGenericType.toErasure(TypePool.java:6668) at net.bytebuddy.pool.TypePool$Default$LazyTypeDescription$GenericTypeToken$Resolution$Raw$RawAnnotatedType.of(TypePool.java:4011) at net.bytebuddy.pool.TypePool$Default$LazyTypeDescription$GenericTypeToken$Resolution$Raw.resolveFieldType(TypePool.java:3898) at net.bytebuddy.pool.TypePool$Default$LazyTypeDescription$LazyFieldDescription.getType(TypePool.java:6965) at net.bytebuddy.description.field.FieldDescription$AbstractBase.asToken(FieldDescription.java:136) at net.bytebuddy.description.field.FieldDescription$AbstractBase.asToken(FieldDescription.java:87) at net.bytebuddy.description.field.FieldList$AbstractBase.asTokenList(FieldList.java:47) at net.bytebuddy.dynamic.scaffold.InstrumentedType$Default.of(InstrumentedType.java:381) at net.bytebuddy.ByteBuddy.redefine(ByteBuddy.java:558) at org.hibernate.bytecode.enhance.internal.bytebuddy.EnhancerImpl.enhance(EnhancerImpl.java:104) at org.hibernate.bytecode.enhance.internal.bytebuddy.EnhancerImpl.enhance(EnhancerImpl.java:126) at org.hibernate.orm.tooling.maven.MavenEnhancePlugin.doEnhancement(MavenEnhancePlugin.java:197) at org.hibernate.orm.tooling.maven.MavenEnhancePlugin.execute(MavenEnhancePlugin.java:138) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) 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:355) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216) at org.apache.maven.cli.MavenCli.main(MavenCli.java:160) 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) Dec 08, 2016 12:36:52 PM org.hibernate.bytecode.enhance.internal.bytebuddy.EnhancerImpl enhance ERROR: HHH000279: Unable to build enhancement metamodel for PostDetails Dec 08, 2016 12:36:52 PM org.hibernate.bytecode.enhance.internal.bytebuddy.EnhancerImpl doEnhance INFO: Enhancing [Tag] as Entity [INFO] Successfully enhanced class [d:\Vlad\Work\HHH\HHH-BB\target\classes\com\vladmihalcea\book\hpjp\hibernate\forum\Tag.class]

To replicate the issue, you can simply run:

1 > mvn clean test-compile

Environment

None

Status

Assignee

Rafael Winterhalter

Reporter

Vlad Mihalcea

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.5

Priority

Major