Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read the array length because "<local3>" thrown by Hibernate 6 when using the PostgreSQLEnumType with Audited #519

Closed
skromberg opened this issue Dec 3, 2022 · 36 comments
Labels

Comments

@skromberg
Copy link

In combination with Envers, Hibernate throws error

java.lang.NullPointerException: Cannot read the array length because "<local3>" is null

	at org.hibernate.type.EnumType.getAnnotation(EnumType.java:228)
	at org.hibernate.type.EnumType.getEnumType(EnumType.java:219)
	at org.hibernate.type.EnumType.setParameterValues(EnumType.java:126)
	at com.vladmihalcea.hibernate.type.basic.PostgreSQLEnumType.setParameterValues(PostgreSQLEnumType.java:46)
	at org.hibernate.mapping.MappingHelper.injectParameters(MappingHelper.java:70)

when I mark up an enum with the @Type(PostgreSQLEnumType.class) annotation. The problem can be reproduced very easily by changing the test as follows:

    @Audited
    @Entity(name = "Post")
    @Table(name = "post")
    public static class Post {

        ...
        
        @Enumerated(EnumType.STRING)
        @Column(columnDefinition = "post_status_info")
        @Type(PostgreSQLEnumType.class)
        private PostStatus status;

       ...
    }

The expected behavior would be that also for the processing of the audit log table the annotations are recognized.

Setup

+- org.springframework.boot:spring-boot-starter-web:jar:3.0.0:compile
+- org.springframework.boot:spring-boot-starter-data-jpa:jar:3.0.0:compile
|  +- org.hibernate.orm:hibernate-core:jar:6.1.5.Final:compile
|  |  +- jakarta.persistence:jakarta.persistence-api:jar:3.1.0:compile
|  |  \- ...
+- org.hibernate.orm:hibernate-envers:jar:6.1.5.Final:compile
+- com.vladmihalcea:hibernate-types-60:jar:2.20.0:compile
@vladmihalcea
Copy link
Owner

Would you like to provide a Pull Request with a fix proposal?

@skromberg
Copy link
Author

skromberg commented Dec 3, 2022

@vladmihalcea - I have now invested three hours to understand the problem. The second call (by @Audited annotation) of the method setParameterValues is executed without the property

org.hibernate.type.ParameterType.xproperty -> {JavaXProperty@7552} "status" with the related annotations

annotationsMethod = {Annotation[3]@7740} 
 0 = {$Proxy46@7746} "@jakarta.persistence.Enumerated(STRING)"
 1 = {$Proxy47@7747} "@jakarta.persistence.Column(nullable=true, precision=0, unique=false, name="", length=255, scale=0, updatable=true, columnDefinition="post_status_info", table="", insertable=true)"
 2 = {$Proxy48@7748} "@org.hibernate.annotations.Type(parameters={}, value=com.vladmihalcea.hibernate.type.basic.PostgreSQLEnumType.class)"

Hibernate should pass this correctly. Maybe my ticket is wrong here - and should be created in Hibernate.

@vladmihalcea
Copy link
Owner

vladmihalcea commented Dec 4, 2022

In that case, you'd need to create a replicating test case using the Hibernate test case template and open a Hibernate issue.

@skromberg
Copy link
Author

https://hibernate.atlassian.net/browse/HHH-15806

@vladmihalcea
Copy link
Owner

Great work 👍

@dmitry-weirdo
Copy link

dmitry-weirdo commented Jan 11, 2023

I think I get the same error after I migrated by app to Spring Boot 3.0.0 which depends on Hibernate and Hibernate Envers 6.1.5 (@vladmihalcea nicely advised me how to do the migration in #514).

And yes, all of my entities are @Audited by Envers.

On the Spring Boot app start, the following is failing:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Cannot read the array length because "<local3>" is null
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1751) ~[spring-beans-6.0.2.jar:6.0.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[spring-beans-6.0.2.jar:6.0.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.0.2.jar:6.0.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.2.jar:6.0.2]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.2.jar:6.0.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.2.jar:6.0.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.2.jar:6.0.2]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130) ~[spring-context-6.0.2.jar:6.0.2]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905) ~[spring-context-6.0.2.jar:6.0.2]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[spring-context-6.0.2.jar:6.0.2]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.0.0.jar:3.0.0]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-3.0.0.jar:3.0.0]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) ~[spring-boot-3.0.0.jar:3.0.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-3.0.0.jar:3.0.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) ~[spring-boot-3.0.0.jar:3.0.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) ~[spring-boot-3.0.0.jar:3.0.0]
	at com.myapp.adapter.cli.SpringBootInitializer.main(SpringBootInitializer.java:19) ~[classes/:?]
	at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:578) ~[?:?]
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-3.0.0.jar:3.0.0]
Caused by: java.lang.NullPointerException: Cannot read the array length because "<local3>" is null
	at org.hibernate.type.EnumType.getAnnotation(EnumType.java:238) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at org.hibernate.type.EnumType.getEnumType(EnumType.java:229) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at org.hibernate.type.EnumType.setParameterValues(EnumType.java:137) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at com.vladmihalcea.hibernate.type.basic.PostgreSQLEnumType.setParameterValues(PostgreSQLEnumType.java:46) ~[hibernate-types-60-2.21.1.jar:?]
	at org.hibernate.mapping.MappingHelper.injectParameters(MappingHelper.java:70) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at org.hibernate.boot.model.TypeDefinition.createResolution(TypeDefinition.java:161) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at org.hibernate.boot.model.TypeDefinition.createLocalResolution(TypeDefinition.java:299) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at org.hibernate.mapping.BasicValue.interpretExplicitlyNamedType(BasicValue.java:681) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at org.hibernate.mapping.BasicValue.buildResolution(BasicValue.java:353) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at org.hibernate.mapping.BasicValue.resolve(BasicValue.java:315) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at org.hibernate.mapping.BasicValue.resolve(BasicValue.java:305) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.lambda$processValueResolvers$4(InFlightMetadataCollectorImpl.java:1767) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at java.util.ArrayList.removeIf(ArrayList.java:1682) ~[?:?]
	at java.util.ArrayList.removeIf(ArrayList.java:1660) ~[?:?]
	at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processValueResolvers(InFlightMetadataCollectorImpl.java:1766) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1752) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.buildMetadataInstance(InFlightMetadataCollectorImpl.java:2292) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:349) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1350) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1421) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
	at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66) ~[spring-orm-6.0.2.jar:6.0.2]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376) ~[spring-orm-6.0.2.jar:6.0.2]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-6.0.2.jar:6.0.2]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-6.0.2.jar:6.0.2]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352) ~[spring-orm-6.0.2.jar:6.0.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797) ~[spring-beans-6.0.2.jar:6.0.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747) ~[spring-beans-6.0.2.jar:6.0.2]
	... 19 more

I debugged the failing line (com.vladmihalcea.hibernate.type.basic.PostgreSQLEnumType#setParameterValues, line 46), and yes, on the 2nd run on the same entities and fields, this property is missing in the parameters):

(country is the name of the entity enum field)

"org.hibernate.type.ParameterType.xproperty" -> {JavaXProperty@14294} "country"

The country field in the entity class looks like this:

    @Enumerated(EnumType.STRING)
    @Column(columnDefinition = "country_enum")
    @Type(PostgreSQLEnumType.class)
    private CountryCode country;

@mirdesai81
Copy link

mirdesai81 commented Jan 25, 2023

The only way I could make enum type work for postgres is to use below

@Enumerated(EnumType.STRING)
@Column(columnDefinition = "<name of enum on DB>")

and add specify stringtype=unspecified in jdbc url.

@JayAhn2
Copy link

JayAhn2 commented Feb 7, 2023

@skromberg Have you managed to find any workaround with this issue currently?

@skromberg
Copy link
Author

@JayAhn2 - No. The error blocks our migration.

@JayAhn2
Copy link

JayAhn2 commented Feb 7, 2023

@skromberg- That's sad. It is the last puzzle for migration :(

@Sturge95
Copy link

Sturge95 commented Mar 2, 2023

@JayAhn2 @SergeiKhmelevSPA

I've got a fix that works, it's not the nicest. But it will carry you over till this gets updated and hibernate 6.2 is released

class GenericEnum<E : Enum<E>> : UserType<E>, ParameterizedType {

    lateinit var enumClass: Class<E>
    override fun equals(x: E?, y: E?): Boolean = x == y

    override fun hashCode(p0: E?): Int {
        return p0?.hashCode() ?: 0
    }

    override fun getSqlType(): Int = Types.OTHER

    override fun returnedClass(): Class<E> = enumClass

    override fun nullSafeGet(rs: ResultSet?, columnIndex: Int, p2: SharedSessionContractImplementor?, p3: Any?): E? {
        val value = rs?.getString(columnIndex)
        return if (rs?.wasNull() == true) null else getEnumValue(enumClass.kotlin, value!!)
    }

    override fun isMutable(): Boolean = false

    override fun assemble(cached: Serializable?, owner: Any?): E? {
        if (cached == null) {
            return null
        }

        if (enumClass.isInstance(cached)) {
            return cached as E
        }

        val name = cached.toString()
        return enumClass.enumConstants?.find { it.toString() == name }
    }

    override fun replace(original: E?, target: E?, owner: Any?): E? {
        if (original == null) {
            return null
        }
        if (enumClass.isInstance(original)) {
            return original as E
        }

        val name = original.toString()
        return enumClass.enumConstants?.find { it.toString() == name }
    }

    override fun disassemble(value: E?): Serializable? {
        if (value == null) {
            return null
        }
        if (enumClass.isInstance(value)) {
            return value
        }
        return value
    }

    override fun deepCopy(value: E?): E? {
        if (value == null) {
            return null
        }
        if (enumClass.isInstance(value)) {
            return getEnumValue(enumClass.kotlin, value.toString())
        }

        return null
    }

   override fun nullSafeGet(rs: ResultSet?, columnIndex: Int, p2: SharedSessionContractImplementor?, p3: Any?): E? {
        val value = rs?.getString(columnIndex)
        if (value == null){
            return null
        }
        return if (rs?.wasNull() == true) null else getEnumValue(enumClass.kotlin, value!!)
    }

    private fun getEnumValue(enumClass: KClass<out E>, name: String): E? {
        return enumClass.java.enumConstants?.find { it.toString() == name }
    }

    override fun setParameterValues(properties: Properties?) {
        val stringClass = properties?.getProperty("enumClass")
        enumClass = Class.forName(stringClass as String) as Class<E>
    }

}

Then it can be referenced as so

@Enumerated(EnumType.STRING)
@Type(GenericEnum::class, parameters = [Parameter(name = "enumClass", value = "iaido.ai.model.entity.StaffStatus")])
var status: StaffStatus = StaffStatus.Active `

@vladmihalcea
Copy link
Owner

Thanks, @Sturge95, for providing a work-around.

@Sturge95
Copy link

Sturge95 commented Mar 2, 2023

@vladmihalcea No worries, it's in Kotlin, but I'm sure people can adapt to Java

@vladmihalcea
Copy link
Owner

vladmihalcea commented Mar 2, 2023

I haven't never used Kotlin, but now that I'm looking at that Type class example, I don't think I'll ever try it.

Unlike Java, C#, Python, or JavaScript, it looks very unintuitive an convoluted.

@Sturge95
Copy link

Sturge95 commented Mar 2, 2023

@vladmihalcea

Don't use the above as an example. It's a nice language when you get used to it.

It has the ? to largely remove NPEs and clean up if checks for null issues, and it has the extendability of C# with extending functions. It's definitely an upgrade on java. Java 2.0

@vladmihalcea
Copy link
Owner

I'm sure that I could get used to it, but Java has been evolveing beautifully over the past years, so I'll stick to it.

@skromberg
Copy link
Author

But it will carry you over till this gets updated and hibernate 6.2 is released

@Sturge95 how do you know that a fix is supposed to be in version 6.2? Currently the ticket is not assigned to a version yet.

@vladmihalcea
Copy link
Owner

vladmihalcea commented Mar 2, 2023

@skromberg As an ex-Hibernate developer, if the ticket was not assigned, it's unlikely that it will be resolved.

So, from my experience, the best way to make sure that a ticket is resolved is if you provide a Pull Request with a fix proposal for it. Otherwise, it may take years if the issue is not critical to the core team. For instance, there will always be issues that will still be unresolved after 10 or 15 years.

@dmitry-weirdo
Copy link

dmitry-weirdo commented Mar 2, 2023

@vladmihalcea but https://hibernate.atlassian.net/browse/HHH-15806 actually has an assignee (Chris Cranford), or am I missing something? It also has a Priority: Major.

@vladmihalcea
Copy link
Owner

vladmihalcea commented Mar 2, 2023

@dmitry-weirdo Here's a list of 250 Major issues from 2004 onward that are all assigned.

I think you are missing the fact that the Hibernate ORM project has a very small team that has to work on:

When I was working on Hibernate, we were 4-5 people working on the project. I bet most of you are working on teams that have more devs than the Hibernate core team.

So, you can follow my advice and provide a fix, or you can leave it to chance and see how it goes. It's up to you.

@Sturge95
Copy link

Sturge95 commented Mar 2, 2023

https://hibernate.atlassian.net/browse/HHH-15806

@skromberg Looks like someone has had a similar issue that has been fixed
https://hibernate.atlassian.net/browse/HHH-15970

@vladmihalcea
Copy link
Owner

@Sturge95 You can test it with Hibernate 6.2 CR2 and see if thd problem was fixed.

@skromberg
Copy link
Author

skromberg commented Mar 2, 2023

@vladmihalcea The snapshot version on master is not compatible with 6.2.0.CR2. Several compiler errors occur. Version 6.1.7 still shows the same problems - it is marked as a fix of the other issue

@vladmihalcea
Copy link
Owner

vladmihalcea commented Mar 2, 2023

If 6.1.7 has the fix for HHH-15970, and you can still replicate this issue mentioned here, then HHH-15970 is not related to HHH-15806.

vladmihalcea added a commit that referenced this issue Mar 26, 2023
Add test case to demonstrate that the issue was fixed in Hibernate 6.2
@vladmihalcea
Copy link
Owner

vladmihalcea commented Mar 26, 2023

@skromberg The issue no longer replicates in HIbernate 6.2, and the project provides the hypersistence-utils-hibernate-62 for Hibernate 6.2.

I created this test case to prove that the problem was solved in Hibernate.

@vladmihalcea vladmihalcea changed the title Envers and Hibernate 6 and PostgreSQLEnumType Cannot read the array length because "<local3>" thrown by Hibernate 6 when using the PostgreSQLEnumType with Audited Mar 26, 2023
@skromberg
Copy link
Author

@skromberg The issue no longer replicates in HIbernate 6.2, and the project provides the hypersistence-utils-hibernate-62 for Hibernate 6.2.

I created this test case to prove that the problem was solved in Hibernate.

Good news! Thanks a lot

@JayAhn2
Copy link

JayAhn2 commented Apr 5, 2023

For boot user, I've tried it with spring boot 3.0.5, but it doesn't work. probably we need to wait till 6.2.x version support from boot.

  implementation("org.springframework.boot:spring-boot-starter-data-jpa") {
    exclude(module = "hibernate-core")
  }
  implementation("org.hibernate:hibernate-core:6.2.0.Final")
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: org/hibernate/type/descriptor/converter/spi/EnumValueConverter
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770) ~[spring-beans-6.0.7.jar:6.0.7]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598) ~[spring-beans-6.0.7.jar:6.0.7]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.7.jar:6.0.7]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.7.jar:6.0.7]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.7.jar:6.0.7]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.7.jar:6.0.7]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.7.jar:6.0.7]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1132) ~[spring-context-6.0.7.jar:6.0.7]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:907) ~[spring-context-6.0.7.jar:6.0.7]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[spring-context-6.0.7.jar:6.0.7]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.0.5.jar:3.0.5]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[spring-boot-3.0.5.jar:3.0.5]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-3.0.5.jar:3.0.5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[spring-boot-3.0.5.jar:3.0.5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304) ~[spring-boot-3.0.5.jar:3.0.5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293) ~[spring-boot-3.0.5.jar:3.0.5]
	at co.sprintapp.api.ApplicationKt.main(Application.kt:32) ~[main/:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-3.0.5.jar:3.0.5]
Caused by: java.lang.NoClassDefFoundError: org/hibernate/type/descriptor/converter/spi/EnumValueConverter
	at io.hypersistence.utils.hibernate.type.HibernateTypesContributor.contribute(HibernateTypesContributor.java:61) ~[hypersistence-utils-hibernate-62-3.3.1.jar:na]
	at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:390) ~[hibernate-core-6.1.7.Final.jar:6.1.7.Final]
	at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:143) ~[hibernate-core-6.1.7.Final.jar:6.1.7.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1348) ~[hibernate-core-6.1.7.Final.jar:6.1.7.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1419) ~[hibernate-core-6.1.7.Final.jar:6.1.7.Final]
	at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66) ~[spring-orm-6.0.7.jar:6.0.7]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376) ~[spring-orm-6.0.7.jar:6.0.7]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-6.0.7.jar:6.0.7]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-6.0.7.jar:6.0.7]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352) ~[spring-orm-6.0.7.jar:6.0.7]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1816) ~[spring-beans-6.0.7.jar:6.0.7]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1766) ~[spring-beans-6.0.7.jar:6.0.7]
	... 21 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.hibernate.type.descriptor.converter.spi.EnumValueConverter
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na]
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[na:na]
	... 33 common frames omitted

@vladmihalcea
Copy link
Owner

It works if you explicitly set the Hibernate version to 6.2.0.Final, which is available on Maven Central.

@jchoe
Copy link

jchoe commented Apr 19, 2023

My app is using Hibernate 6.2.1.Final explicitly stated in pom, along with Spring Boot 3.0.5.
I have a number of Enums in my entities, such as

...... @Enumerated(EnumType.STRING) @org.hibernate.annotations.Type(value = PostgreSQLEnumType.class) @Column(columnDefinition = "client_publisher_status") private Status status; ........

When I start my app, I get the following error.
Caused by: java.lang.NullPointerException: Cannot invoke "org.hibernate.boot.spi.MetadataBuildingContext.getMetadataCollector()" because "this.metadataBuildingContext" is null at org.hibernate.type.spi.TypeConfiguration$Scope.getDialect(TypeConfiguration.java:459) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.type.EnumType$LocalJdbcTypeIndicators.getDialect(EnumType.java:516) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.type.descriptor.jdbc.VarcharJdbcType.shouldUseMaterializedLob(VarcharJdbcType.java:90) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.type.descriptor.jdbc.VarcharJdbcType.resolveIndicatedType(VarcharJdbcType.java:79) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.type.descriptor.java.BasicJavaType.getRecommendedJdbcType(BasicJavaType.java:33) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.type.descriptor.java.StringJavaType.getRecommendedJdbcType(StringJavaType.java:56) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.type.EnumType.configureUsingReader(EnumType.java:180) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.type.EnumType.setParameterValues(EnumType.java:142) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at com.vladmihalcea.hibernate.type.basic.PostgreSQLEnumType.setParameterValues(PostgreSQLEnumType.java:46) ~[hibernate-types-60-2.21.1.jar:na] at org.hibernate.mapping.MappingHelper.injectParameters(MappingHelper.java:107) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.mapping.BasicValue.setExplicitCustomType(BasicValue.java:836) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.boot.model.internal.BasicValueBinder.fillSimpleValue(BasicValueBinder.java:1363) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.boot.model.internal.SetBasicValueTypeSecondPass.doSecondPass(SetBasicValueTypeSecondPass.java:27) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1846) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1792) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:328) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1380) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1451) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66) ~[spring-orm-6.0.7.jar:6.0.7] at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376) ~[spring-orm-6.0.7.jar:6.0.7] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-6.0.7.jar:6.0.7] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-6.0.7.jar:6.0.7] at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352) ~[spring-orm-6.0.7.jar:6.0.7] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1816) ~[spring-beans-6.0.7.jar:6.0.7] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1766) ~[spring-beans-6.0.7.jar:6.0.7] ... 16 common frames omitted

@vladmihalcea
Copy link
Owner

@jchoe That's because you're using the old hibernate-types-60-2.21.1 dependency that's no longer maintained.

The project is called Hypersistence Utils now and it offers a module for Hibernate 6.2. You need to upgrade to version 3 as explained by this issue.

@jchoe
Copy link

jchoe commented Apr 20, 2023

@vladmihalcea Thanks, but even with the latest library, the problem persits.

Caused by: java.lang.NullPointerException: Cannot invoke "org.hibernate.boot.spi.MetadataBuildingContext.getMetadataCollector()" because "this.metadataBuildingContext" is null at org.hibernate.type.spi.TypeConfiguration$Scope.getDialect(TypeConfiguration.java:459) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.type.EnumType$LocalJdbcTypeIndicators.getDialect(EnumType.java:516) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.type.descriptor.jdbc.VarcharJdbcType.shouldUseMaterializedLob(VarcharJdbcType.java:90) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.type.descriptor.jdbc.VarcharJdbcType.resolveIndicatedType(VarcharJdbcType.java:79) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.type.descriptor.java.BasicJavaType.getRecommendedJdbcType(BasicJavaType.java:33) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.type.descriptor.java.StringJavaType.getRecommendedJdbcType(StringJavaType.java:56) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.type.EnumType.configureUsingReader(EnumType.java:180) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.type.EnumType.setParameterValues(EnumType.java:142) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at io.hypersistence.utils.hibernate.type.basic.PostgreSQLEnumType.setParameterValues(PostgreSQLEnumType.java:46) ~[hypersistence-utils-hibernate-60-3.3.2.jar:na] at org.hibernate.mapping.MappingHelper.injectParameters(MappingHelper.java:107) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.mapping.BasicValue.setExplicitCustomType(BasicValue.java:836) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.boot.model.internal.BasicValueBinder.fillSimpleValue(BasicValueBinder.java:1363) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.boot.model.internal.SetBasicValueTypeSecondPass.doSecondPass(SetBasicValueTypeSecondPass.java:27) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1846) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1792) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:328) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1380) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1451) ~[hibernate-core-6.2.1.Final.jar:6.2.1.Final]

@vladmihalcea
Copy link
Owner

This test case works fine with Hibernate 6.2.

Try to run both and see why mine is working ad yours is not.

@skromberg
Copy link
Author

The entire package is on its way:

https://github.com/spring-projects/spring-boot/releases/tag/v3.1.0-RC1

Upgrade to Hibernate 6.2.1.Final spring-projects/spring-boot#35000

@chpasha
Copy link

chpasha commented May 2, 2023

@vladmihalcea Thanks, but even with the latest library, the problem persits.

you still use hypersistence-utils-hibernate-60 but there is a hypersistence-utils-hibernate-62

@dmitry-weirdo
Copy link

dmitry-weirdo commented Jan 2, 2024

I got exactly the same error as @chpasha when I try to upgrade from Spring Boot 3.1.7 to 3.2.1:

14:23:07.923 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: org/hibernate/type/descriptor/converter/spi/EnumValueConverter
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1773) ~[spring-beans-6.1.2.jar:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[spring-beans-6.1.2.jar:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.1.2.jar:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.1.2.jar:6.1.2]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.2.jar:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.1.2.jar:6.1.2]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.1.2.jar:6.1.2]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1232) ~[spring-context-6.1.2.jar:6.1.2]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:950) ~[spring-context-6.1.2.jar:6.1.2]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625) ~[spring-context-6.1.2.jar:6.1.2]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.1.jar:3.2.1]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) ~[spring-boot-3.2.1.jar:3.2.1]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:464) ~[spring-boot-3.2.1.jar:3.2.1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[spring-boot-3.2.1.jar:3.2.1]
	at org.springframework.boot.test.context.SpringBootContextLoader.lambda$loadContext$3(SpringBootContextLoader.java:137) ~[spring-boot-test-3.2.1.jar:3.2.1]
	at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58) ~[spring-core-6.1.2.jar:6.1.2]
	at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46) ~[spring-core-6.1.2.jar:6.1.2]
	at org.springframework.boot.SpringApplication.withHook(SpringApplication.java:1458) ~[spring-boot-3.2.1.jar:3.2.1]
	at org.springframework.boot.test.context.SpringBootContextLoader$ContextLoaderHook.run(SpringBootContextLoader.java:552) ~[spring-boot-test-3.2.1.jar:3.2.1]
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:137) ~[spring-boot-test-3.2.1.jar:3.2.1]
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:108) ~[spring-boot-test-3.2.1.jar:3.2.1]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:225) ~[spring-test-6.1.2.jar:6.1.2]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:152) ~[spring-test-6.1.2.jar:6.1.2]
	at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:130) ~[spring-test-6.1.2.jar:6.1.2]
	at org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener.postProcessFields(MockitoTestExecutionListener.java:110) ~[spring-boot-test-3.2.1.jar:3.2.1]
	at org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener.injectFields(MockitoTestExecutionListener.java:94) ~[spring-boot-test-3.2.1.jar:3.2.1]
	at org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener.prepareTestInstance(MockitoTestExecutionListener.java:61) ~[spring-boot-test-3.2.1.jar:3.2.1]
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:260) ~[spring-test-6.1.2.jar:6.1.2]
	at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:163) ~[spring-test-6.1.2.jar:6.1.2]
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$10(ClassBasedTestDescriptor.java:378) ~[junit-jupiter-engine-5.10.1.jar:5.10.1]
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.executeAndMaskThrowable(ClassBasedTestDescriptor.java:383) ~[junit-jupiter-engine-5.10.1.jar:5.10.1]
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$11(ClassBasedTestDescriptor.java:378) ~[junit-jupiter-engine-5.10.1.jar:5.10.1]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[?:?]
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[?:?]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
	at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310) ~[?:?]
	at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735) ~[?:?]
	at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734) ~[?:?]
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[?:?]
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestInstancePostProcessors(ClassBasedTestDescriptor.java:377) ~[junit-jupiter-engine-5.10.1.jar:5.10.1]
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$instantiateAndPostProcessTestInstance$6(ClassBasedTestDescriptor.java:290) ~[junit-jupiter-engine-5.10.1.jar:5.10.1]
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:289) ~[junit-jupiter-engine-5.10.1.jar:5.10.1]
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$4(ClassBasedTestDescriptor.java:279) ~[junit-jupiter-engine-5.10.1.jar:5.10.1]
	at java.util.Optional.orElseGet(Optional.java:364) ~[?:?]
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$5(ClassBasedTestDescriptor.java:278) ~[junit-jupiter-engine-5.10.1.jar:5.10.1]
	at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31) ~[junit-jupiter-engine-5.10.1.jar:5.10.1]
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:106) ~[junit-jupiter-engine-5.10.1.jar:5.10.1]
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:105) ~[junit-jupiter-engine-5.10.1.jar:5.10.1]
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:69) ~[junit-jupiter-engine-5.10.1.jar:5.10.1]
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$2(NodeTestTask.java:123) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:123) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:90) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54) ~[junit-platform-engine-1.10.1.jar:1.10.1]
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:198) ~[junit-platform-launcher-1.10.1.jar:1.10.1]
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:169) ~[junit-platform-launcher-1.10.1.jar:1.10.1]
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:93) ~[junit-platform-launcher-1.10.1.jar:1.10.1]
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:58) ~[junit-platform-launcher-1.10.1.jar:1.10.1]
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:141) [junit-platform-launcher-1.10.1.jar:1.10.1]
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:57) [junit-platform-launcher-1.10.1.jar:1.10.1]
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:103) [junit-platform-launcher-1.10.1.jar:1.10.1]
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:85) [junit-platform-launcher-1.10.1.jar:1.10.1]
	at org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47) [junit-platform-launcher-1.10.1.jar:1.10.1]
	at org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:50) [surefire-junit-platform-3.1.0.jar:3.1.0]
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:184) [surefire-junit-platform-3.1.0.jar:3.1.0]
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:148) [surefire-junit-platform-3.1.0.jar:3.1.0]
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122) [surefire-junit-platform-3.1.0.jar:3.1.0]
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385) [surefire-booter-3.1.0.jar:3.1.0]
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162) [surefire-booter-3.1.0.jar:3.1.0]
	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507) [surefire-booter-3.1.0.jar:3.1.0]
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495) [surefire-booter-3.1.0.jar:3.1.0]
Caused by: java.lang.NoClassDefFoundError: org/hibernate/type/descriptor/converter/spi/EnumValueConverter
	at io.hypersistence.utils.hibernate.type.HibernateTypesContributor.contribute(HibernateTypesContributor.java:61) ~[hypersistence-utils-hibernate-62-3.3.2.jar:?]
	at org.hibernate.boot.internal.MetadataBuilderImpl.applyTypes(MetadataBuilderImpl.java:295) ~[hibernate-core-6.4.1.Final.jar:6.4.1.Final]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
	at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1092) ~[?:?]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.applyTypeContributors(EntityManagerFactoryBuilderImpl.java:1404) ~[hibernate-core-6.4.1.Final.jar:6.4.1.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.applyMetamodelBuilderSettings(EntityManagerFactoryBuilderImpl.java:1385) ~[hibernate-core-6.4.1.Final.jar:6.4.1.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:280) ~[hibernate-core-6.4.1.Final.jar:6.4.1.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:198) ~[hibernate-core-6.4.1.Final.jar:6.4.1.Final]
	at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:63) ~[spring-orm-6.1.2.jar:6.1.2]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376) ~[spring-orm-6.1.2.jar:6.1.2]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-6.1.2.jar:6.1.2]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-6.1.2.jar:6.1.2]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352) ~[spring-orm-6.1.2.jar:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1820) ~[spring-beans-6.1.2.jar:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1769) ~[spring-beans-6.1.2.jar:6.1.2]
	... 96 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.type.descriptor.converter.spi.EnumValueConverter
	at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[?:?]
	at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[?:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
	at io.hypersistence.utils.hibernate.type.HibernateTypesContributor.contribute(HibernateTypesContributor.java:61) ~[hypersistence-utils-hibernate-62-3.3.2.jar:?]
	at org.hibernate.boot.internal.MetadataBuilderImpl.applyTypes(MetadataBuilderImpl.java:295) ~[hibernate-core-6.4.1.Final.jar:6.4.1.Final]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
	at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1092) ~[?:?]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.applyTypeContributors(EntityManagerFactoryBuilderImpl.java:1404) ~[hibernate-core-6.4.1.Final.jar:6.4.1.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.applyMetamodelBuilderSettings(EntityManagerFactoryBuilderImpl.java:1385) ~[hibernate-core-6.4.1.Final.jar:6.4.1.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:280) ~[hibernate-core-6.4.1.Final.jar:6.4.1.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:198) ~[hibernate-core-6.4.1.Final.jar:6.4.1.Final]
	at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:63) ~[spring-orm-6.1.2.jar:6.1.2]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376) ~[spring-orm-6.1.2.jar:6.1.2]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-6.1.2.jar:6.1.2]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-6.1.2.jar:6.1.2]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352) ~[spring-orm-6.1.2.jar:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1820) ~[spring-beans-6.1.2.jar:6.1.2]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1769) ~[spring-beans-6.1.2.jar:6.1.2]
	... 96 more

@vladmihalcea
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants