JBoss AS 7 not using WEB-INF hibernate lib and throwing "Unknown service requested [org.hibernate.boot.registry.classloading.spi.ClassLoaderService]"
<p>I'm migrating a Spring+Hibernate application from Weblogic 12c to JBoss AS 7, and I'm getting the following error:</p>

<pre><code>20:07:47,395 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.persistenceunit."connecta-presenter-2.2.1.war#ConnectaPresenterPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."connecta-presenter-2.2.1.war#ConnectaPresenterPU": Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_95]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_95]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_95]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: ConnectaPresenterPU] Unable to build EntityManagerFactory
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
    at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    ... 3 more
Caused by: org.hibernate.service.UnknownServiceException: Unknown service requested [org.hibernate.boot.registry.classloading.spi.ClassLoaderService]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:126)
    at org.hibernate.search.hcore.impl.HibernateSearchIntegrator.integrate(HibernateSearchIntegrator.java:49)
    at org.hibernate.internal.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:294)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)
    at org.hibernate.ejb.EntityManagerFactoryImpl.&lt;init&gt;(EntityManagerFactoryImpl.java:84)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
    ... 9 more
</code></pre>

<p>The <code>Unknown service requested [org.hibernate.boot.registry.classloading.spi.ClassLoaderService]</code> message thrown by line 126 of <code>org.hibernate.service.internal.AbstractServiceRegistryImpl</code> is an exception <strong>thrown only in version 4.0.1 of Hibernate Core</strong>, which is the version that is in my JBoss AS 7 modules folder.</p>

<p>The thing is that my application uses <strong>Hibernate 4.3.10</strong>, and this specific line doesn't exist more in this version (I could see comparing the source code on Github).</p>

<p>The following documentation on JBoss AS 7 site states that when you migrate from Weblogic to JBoss:</p>

<p><a href="https://docs.jboss.org/author/display/AS72/How+do+I+migrate+my+application+from+WebLogic+to+AS+7#HowdoImigratemyapplicationfromWebLogictoAS7-Migrateweblogic.xmlDescriptorFileConfigurations" rel="nofollow">https://docs.jboss.org/author/display/AS72/How+do+I+migrate+my+application+from+WebLogic+to+AS+7#HowdoImigratemyapplicationfromWebLogictoAS7-Migrateweblogic.xmlDescriptorFileConfigurations</a></p>

<p>So there's no such code as the following in <code>jboss-web.xml</code> file:</p>

<pre><code>&lt;prefer-application-packages&gt;
  &lt;package-name&gt;javassist.*&lt;/package-name&gt;
&lt;/prefer-application-packages&gt;
</code></pre>

<p>It says that JBoss always uses <code>WEB-INF/classes</code> and <code>WEB-INF/lib</code> before the internal modules.</p>

<p>Any idea of what's happening?</p>