title: JBOSS doesn't take my own libs
body: <p><strong>Check out my answer for solution</strong></p>
  
  <p>I'm deploying a WAR in a Jboss Server, but I don't get that Jboss take my own libs, it is using its own libs (I think that is my problem).</p>
  
  <pre><code>Structure of my project:
  - projectName
  --- src
  ----- main
  -------webapp
  ---------WEB-INF
  -----------jboss-classloading.xml
  -----------jboss-deployment-structure.xml
  -----------jboss-web.xml
  
  ---target
  -----wars
  -------myWar.war
  </code></pre>
  
  <p>At first I only had jboss-web.xml and jboss-deployment-structure but I read that jboss-classloading is necessary for this problem.</p>
  
  <pre><code>jboss-web.xml
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;  
  &lt;jboss-web&gt;
  &lt;context-root&gt;/myProject&lt;/context-root&gt;
  &lt;class-loading java2ClassLoadingCompliance="false"&gt;
      &lt;loader-repository&gt;projectName/src/target/wars:loader=myWar.war
          &lt;loader-repository-config&gt;java2ParentDelegation=false&lt;/loader-repository-config&gt;
      &lt;/loader-repository&gt;
  &lt;/class-loading&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>jboss-classloading.xml
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;classloading xmlns="urn:jboss:classloading:1.0"
  parent-first="false"
  domain="myWar.war"
  top-level-classloader="true"
  export-all="NON_EMPTY"
  import-all="false"&gt;
  &lt;/classloading&gt;
  </code></pre>
  
  <p>It shows me 2 errors:</p>
  
  <pre><code>30/07/2015 07:30:03,795 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."myWar.war".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."myWar.war".FIRST_MODULE_USE: JBAS018733: Error al procesar la fase FIRST_MODULE_USE de deployment "myWar.war"
          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_40]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_40]
          at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_40]
  Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011426: No se pudo implementar el proveedor de persistencia empacado de la aplicación 'org.hibernate.ejb.HibernatePersistence'
          at org.jboss.as.jpa.processor.PersistenceProviderHandler.deploy(PersistenceProviderHandler.java:79)
          at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:45)
          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
          ... 5 more
  Caused by: java.lang.ClassCastException: class org.hibernate.ejb.HibernatePersistence
          at java.lang.Class.asSubclass(Class.java:3404) [rt.jar:1.8.0_40]
          at org.jboss.as.jpa.processor.PersistenceProviderHandler.deploy(PersistenceProviderHandler.java:73)
          ... 7 more
  </code></pre>
  
  <p><br/></p>
  
  <pre><code>30/07/2015 11:47:03,930 ERROR [org.jboss.msc.service.fail] (MSC service     thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."myWar.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."myWar.war".PARSE: JBAS018733: Error al procesar la fase PARSE de deployment "myWar.war"
  at   org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
  at  org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
  at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_40]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_40]
  at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_40]
  Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018014: No se logró analizar sintácticamente el descriptor "/content/myWar.war/WEB-INF/jboss-web.xml" en [4,5]
  at org.jboss.as.web.deployment.JBossWebParsingDeploymentProcessor.deploy(JBossWebParsingDeploymentProcessor.java:79)
  at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
  ... 5 more
  Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[4,5]
  Message: Unexpected element 'class-loading' encountered
  at org.jboss.metadata.parser.util.MetaDataElementParser.unexpectedElement(MetaDataElementParser.java:109)
  at org.jboss.metadata.parser.jbossweb.JBossWebMetaDataParser.parse(JBossWebMetaDataParser.java:210)
  at org.jboss.as.web.deployment.JBossWebParsingDeploymentProcessor.deploy(JBossWebParsingDeploymentProcessor.java:71)
  ... 6 more
  </code></pre>
  
  <p><br/>
  If you need more information let me know it.</p>
  
  <p>Thank you in advance.</p>
  
  <p><strong>EDIT WITH NEW ERROR</strong></p>
  
  <pre><code>31/07/2015 12:29:52,896 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ksjm_ksjm_01]] (ServerService Thread Pool -- 53) JBWEB000287: Exception sending context initialized event to listener instance of class com.grupobbva.sl.soa.gui.catalogos.ApplicationContextListener: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grupoDaoImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.grupobbva.sl.soa.configuracion.dao.impl.AbstractDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring/dao-configuracion-applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory
  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288) [spring-beans-3.2.3.RELEASE.jar:3.2.3.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116) [spring-beans-3.2.3.RELEASE.jar:3.2.3.RELEASE]
  </code></pre>
  
  <p><br/>
      dao-configuracion-applicationContext.xml
  <br/><br/>    </p>
  
  <pre><code>&lt;bean id="dataSource"
      class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
      &lt;property name="driverClassName" value="${configuracion.servicio.driverClassName}" /&gt;
      &lt;property name="url" value="${configuracion.servicio.url}" /&gt;
      &lt;property name="username" value="${usuario}" /&gt;
      &lt;property name="password" value="${password}" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="sessionFactory"
      class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.hbm2ddl.auto"&gt;${configuracion.servicio.hbm2ddl}&lt;/prop&gt;
              &lt;prop key="hibernate.dialect"&gt;${configuracion.servicio.dialect}&lt;/prop&gt;
              &lt;prop key="javax.persistence.jdbc.driver"&gt;${configuracion.servicio.driverClassName}&lt;/prop&gt;
              &lt;prop key="hibernate.default_schema"&gt;${configuracion.servicio.default-schema}&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
      &lt;property name="packagesToScan"
          value="com.grupobbva.sl.soa.core.domain, com.grupobbva.sl.soa.core.domain.config" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p></p>
  
  <p>I have read in other post that it would work if I upgrade my sessionFactory bean to hibernate 4....but it does not work for me =(</p>