patrick
patrick

Reputation: 111

Hibernate types and JBoss compatibility issue

I'd like to use the hibernate-types library to map JSON collections to Postgres JSONB database columns using JPA and Hibernate but when I deploy my application I receive the following error:

Caused by: java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/XProperty
at com.vladmihalcea.hibernate.type.json.internal.JsonTypeDescriptor.setParameterValues(JsonTypeDescriptor.java:58) 
at com.vladmihalcea.hibernate.type.json.JsonBinaryType.setParameterValues(JsonBinaryType.java:66) 
at org.hibernate.type.TypeFactory.injectParameters(TypeFactory.java:142)`

The class is indeed present in the jar provided by JBoss but it looks like the ModuleClassLoader is not able to find it. The Hibernate version provided by JBoss is 5.1.10.Final-redhat-1 and the version of the hibernate-commons-annotations where the XProperty class is defined is 5.0.1.Final-redhat-2. Any idea about what is missing to make things work? Thanks a lot

Upvotes: 5

Views: 1437

Answers (2)

Tomasz Knyziak
Tomasz Knyziak

Reputation: 343

This can also be configured in WEB-INF/jboss-deployment-structure.xml file as:

<jboss-deployment-structure>
    <deployment>
        <dependencies>
            <module name="org.hibernate.commons-annotations"/>
        </dependencies>
    </deployment>
</jboss-deployment-structure>

Upvotes: 3

Wildfly provide hibernate, and the class is searched in the ear. I changed ear's pom so:

path : "maven-ear-plugin".configuration.archive

<manifestEntries>
    <Dependencies>org.hibernate.commons-annotations</Dependencies>
</manifestEntries>

So find the XProperty class.

H.

Upvotes: 6

Related Questions