question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/XProperty

See original GitHub issue

Hi, I am trying to use this lib in a webapp, deployed to Wildfly 16 (hibernate 5.3.9). I have added the dependency:

    <dependency>
      <groupId>com.vladmihalcea</groupId>
      <artifactId>hibernate-types-52</artifactId>
      <version>2.4.3</version>
    </dependency>

My dependency to hibernate-core is in provided scope.

I got this exception on deploy:

WFLYCTL0186:   Services which failed to start:      service jboss.persistenceunit."aurora.war#pu": java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/XProperty
WFLYCTL0448: 48 additional services are down due to their dependencies being missing or failed

Do I have to add an explicit dependency to hibernate-common-annotations in the compile scope?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nubenumcommented, Jan 19, 2021

So in my case the solution to make it work with Wildfly 20 was to create the jboss-deployment-structure.xml file in the webapp/WEB-INF directory with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <dependencies>
            <module name="org.hibernate.commons-annotations"/>
        </dependencies>
    </deployment>
</jboss-deployment-structure>
1reaction
ceccommented, Nov 13, 2019

Hi @vladmihalcea and @kiview

I’m on WildFly 10, which comes with hibernate-commons-annotations-5.0.1.Final.

I added hibernate-commons-annotations-5.1.0.Final and updated module.xml to point to it.

In pom.xml I added

        <dependency>
            <groupId>org.hibernate.common</groupId>
            <artifactId>hibernate-commons-annotations</artifactId>
            <version>5.1.0.Final</version>
            <scope>provided</scope>
        </dependency>

However I still get java.lang.ClassNotFoundException: org.hibernate.annotations.common.reflection.XProperty .

Did you manage to fix this?

Otherwise I’ll prepare a reproduction project so that it can be analyzed and resolved

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I solve "java.lang.NoClassDefFoundError"?
The NoClassDefFoundError indicates that the classloader (in this case java.net.URLClassLoader ), which is responsible for dynamically loading classes, cannot ...
Read more >
3 ways to solve java.lang.NoClassDefFoundError in Java J2EE
A simple example of NoClassDefFoundError is class belongs to a missing JAR file or JAR was not added into classpath or sometimes jar's...
Read more >
java.lang.NoClassDefFoundError - DigitalOcean
NoClassDefFoundError is runtime error thrown when a required class is not found in the classpath and hence JVM is unable to load it...
Read more >
Error "java.lang.NoClassDefFoundError - My Oracle Support
Error "java.lang.NoClassDefFoundError: com/oracle/cie/encryption/AbstractEncryptionService" Starting a Collocated Agent after Updating ...
Read more >
Why am I encountering java.lang.NoClassDefFoundError at ...
In workbench, adding projects directly to the java build path will allow code to compile, but it will not be able to resolve...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found