Caused by: java.lang.IllegalArgumentException: Cannot subclass primitive, array or final types
See original GitHub issueI have a base model in kotlin similar to the following:
@MappedSuperclass
abstract class BaseModel : Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
var id: Long? = null
var deleted: Boolean = false
}
And another entity
inheriting from the base model similar to:
@Entity
data class Person(
var firstName: String = "",
var lastName: String = "",
@get:Email
var email: String = ""
) : BaseModel()
Stack trace:
ERROR [io.qua.dev.DevModeMain] (main) Failed to start Quarkus: java.lang.ExceptionInInitializerError
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at io.quarkus.runner.bootstrap.StartupActionImpl.run(StartupActionImpl.java:80)
at io.quarkus.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:60)
at io.quarkus.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:236)
at io.quarkus.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:39)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:131)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:84)
at io.quarkus.dev.DevModeMain.start(DevModeMain.java:104)
at io.quarkus.dev.DevModeMain.main(DevModeMain.java:46)
Caused by: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:482)
... 10 more
Caused by: java.lang.IllegalArgumentException: Could not create type
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:154)
at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:365)
Caused by: java.lang.RuntimeException: Failed to start quarkus
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:174)
Caused by: java.lang.IllegalArgumentException: Could not create type
at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:376)
at org.hibernate.bytecode.internal.bytebuddy.ByteBuddyState.load(ByteBuddyState.java:175)
at org.hibernate.bytecode.internal.bytebuddy.ByteBuddyState.loadProxy(ByteBuddyState.java:99)
at org.hibernate.proxy.pojo.bytebuddy.ByteBuddyProxyHelper.buildProxy(ByteBuddyProxyHelper.java:54)
at io.quarkus.hibernate.orm.runtime.proxies.ProxyDefinitions.generateProxyClass(ProxyDefinitions.java:85)
at io.quarkus.hibernate.orm.runtime.proxies.ProxyDefinitions.createFromMetadata(ProxyDefinitions.java:47)
at io.quarkus.hibernate.orm.runtime.boot.FastBootMetadataBuilder.build(FastBootMetadataBuilder.java:338)
at io.quarkus.hibernate.orm.runtime.PersistenceUnitsHolder.createMetadata(PersistenceUnitsHolder.java:111)
at io.quarkus.hibernate.orm.runtime.PersistenceUnitsHolder.constructMetadataAdvance(PersistenceUnitsHolder.java:84)
at io.quarkus.hibernate.orm.runtime.PersistenceUnitsHolder.initializeJpa(PersistenceUnitsHolder.java:47)
at io.quarkus.hibernate.orm.runtime.HibernateOrmRecorder$4.created(HibernateOrmRecorder.java:75)
at io.quarkus.arc.runtime.ArcRecorder.initBeanContainer(ArcRecorder.java:102)
at io.quarkus.deployment.steps.ArcProcessor$generateResources28.deploy_0(ArcProcessor$generateResources28.zig:454)
at io.quarkus.deployment.steps.ArcProcessor$generateResources28.deploy(ArcProcessor$generateResources28.zig:36)
at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:444)
... 10 more
Caused by: java.lang.IllegalArgumentException: Cannot subclass primitive, array or final types: class ...
at net.bytebuddy.ByteBuddy.subclass(ByteBuddy.java:406)
Caused by: java.lang.IllegalArgumentException: Cannot subclass primitive, array or final types: class ...
at net.bytebuddy.ByteBuddy.subclass(ByteBuddy.java:299)
at org.hibernate.proxy.pojo.bytebuddy.ByteBuddyProxyHelper.lambda$buildProxy$0(ByteBuddyProxyHelper.java:57)
at org.hibernate.bytecode.internal.bytebuddy.ByteBuddyState.lambda$load$0(ByteBuddyState.java:178)
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:152)
... 27 more
Failing versions: 1.3.0.CR1 and CR2 Prev working versions: 1.2.0 and 1.2.1
Issue Analytics
- State:
- Created 4 years ago
- Comments:19 (11 by maintainers)
Top Results From Across the Web
java.lang.IllegalArgumentException: Cannot subclass final class
Any ideas why this is not working and I get the error message when I run the testcase? java.lang.IllegalArgumentException: Cannot subclass final class...
Read more >Best of Java : ERROR - the type cannot subclass the final class
Final Class cannot be sub classed. Remove Final modifier from the parent class or don't extend it.
Read more >Redchilliplus's Blog – little extra..
java.lang.IllegalArgumentException: Cannot subclass final class class ... Too many request can cause frequent thread creation and tear down.
Read more >【异常解决记录】Cannot subclass final class ... - CSDN博客
【严肃地说:文字记录是必须养成的习惯】二、解决方案本人解决方案:升级Spring相关依赖版本参考:Cannot subclass final class class com.sun.proxy.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This really looks like a bytebuddy issue, see here: Mockito similar issue
I think this is caused by the upgrade of ByteBuddy. The
Person
entity is a final class, and the new version of ByteBuddy is strictly checking against this.I would need to check if something is possible in ByteBuddy to be more lenient.