ClassNotFoundException occurring even though dependency is specified in jboss-deploment-structure.xml in JBoss EAP 6

Solution Verified - Updated -

Issue

  • Getting ClassNotFound even though dependency was specified on JBoss module in JBoss EAP 6. Below is the class not found:
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
Caused by: java.lang.ClassNotFoundException: org.hibernate.cfg.Configuration from [Module "deployment.webapp.war:main" from Service Module Loader]
        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:196) [jboss-modules.jar:1.2.2.Final-redhat-1]
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444) [jboss-modules.jar:1.2.2.Final-redhat-1]
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432) [jboss-modules.jar:1.2.2.Final-redhat-1]
        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374) [jboss-modules.jar:1.2.2.Final-redhat-1]
        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119) [jboss-modules.jar:1.2.2.Final-redhat-1]
        ... 47 more

Out module dependency is specified in webapp.war/WEB-INF/jboss-deploment-structure.xml

<jboss-deployment-structure>
   <deployment>
      <dependencies>
          <module name="org.hibernate" export="true" services="import" meta-inf="import"/>
          <module name="org.hibernate.commons-annotations" export="true" services="import" meta-inf="import"/>
          <module name="org.hibernate.validator" export="true" services="import" meta-inf="import"/>
       </dependencies>
   </deployment>
</jboss-deployment-structure>

Environment

Red Hat JBoss Enterprise Application Platform (EAP) 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content