I have
public class DBListColumnType implements UserType<List<?>>, DynamicParameterizedType
and field in Entity
@Type (
value = DBListColumnType.class,
parameters = {@Parameter (name = "entityClass", value = "rentp.vintech.entity.AudioTrack")}
)
@Column(name = "tracks")
private List<AudioTrack> tracks;
When I execute its app locally (in VSCodium) then it runs successfully.
But after deploying it onto Tomcat 10 I got error -
LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is java.lang.ClassCastException: class org.hibernate.type.CustomType cannot be cast to class org.hibernate.type.BasicPluralType (org.hibernate.type.CustomType and org.hibernate.type.BasicPluralType are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @7fc6de5b)
2026-06-21T21:03:20.186+03:00 WARN 3033 — [VinTech] [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘entityManagerFactory’ defined in class path resource [rentp/vintech/DataSourceConfiguration.class]: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is java.lang.ClassCastException: class org.hibernate.type.CustomType cannot be cast to class org.hibernate.type.BasicPluralType (org.hibernate.type.CustomType and org.hibernate.type.BasicPluralType are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @7fc6de5b)
Have I to implement BasicPluralType instead of UserType in this case or it’s Tomcat’s config error?
Java 17.0.7
Spring 3.5.15
Hibernate ORM core version 6.6.53.Final
on
CentOS 9 with Tomcat 10.1.55