1 Reply Latest reply on Sep 26, 2013 9:59 AM by erasmo2 marciano2

    Ignore JBOSS 7.1.1 Hibernate

    Thiago Donadel Newbie

      Hello.

       

      I'm trying to use the hibernate .jars inside my application, but I'm having some problems to "remove" the native jboss depencies. I'm already added the:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss-deployment-structure>

        <deployment>

        <exclusions>

        <module name="org.hibernate" />

        </exclusions>

        </deployment>

      </jboss-deployment-structure>

       

      but when I did that, i got a lot of errors like:

       

      09:42:36,927 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 50) MSC00001: Failed to start service jboss.persistenceunit."caption.war#gesplan": org.jboss.msc.service.StartException in service jboss.persistenceunit."caption.war#gesplan": javax.persistence.PersistenceException: Cannot find scanner class. hibernate.ejb.resource_scanner=org.jboss.as.jpa.hibernate4.HibernateAnnotationScanner

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:100) [jboss-as-jpa-7.1.3.Final.jar:7.1.3.Final]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]

        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]

        at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA.jar:2.0.0.GA]

      Caused by: javax.persistence.PersistenceException: Cannot find scanner class. hibernate.ejb.resource_scanner=org.jboss.as.jpa.hibernate4.HibernateAnnotationScanner

        at org.hibernate.ejb.Ejb3Configuration.buildScanner(Ejb3Configuration.java:405)

        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:592)

        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:75)

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:197) [jboss-as-jpa-7.1.3.Final.jar:7.1.3.Final]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$500(PersistenceUnitServiceImpl.java:57) [jboss-as-jpa-7.1.3.Final.jar:7.1.3.Final]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:96) [jboss-as-jpa-7.1.3.Final.jar:7.1.3.Final]

        ... 4 more

      Caused by: java.lang.ClassNotFoundException: org.jboss.as.jpa.hibernate4.HibernateAnnotationScanner from [Module "deployment.caption.war:main" from Service Module Loader]

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.3.GA]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.3.GA]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.3.GA]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.3.GA]

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.3.GA]

        at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_21]

        at java.lang.Class.forName(Class.java:266) [rt.jar:1.7.0_21]

        at org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:170)

        at org.hibernate.ejb.Ejb3Configuration.buildScanner(Ejb3Configuration.java:402)

        ... 9 more

       

      Here is my persistance.xml

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!--persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"

        version="2.1" -->

      <persistence xmlns="http://java.sun.com/xml/ns/persistence"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"

        version="2.0">

        <persistence-unit name="gesplan" transaction-type="JTA">

             <provider>org.hibernate.ejb.HibernatePersistence</provider>

             <jta-data-source>java:/USR_JULIANO</jta-data-source>

       

            <properties>

                 <property name="hibernate.archive.autodetection" value="class" />

                 <property name="hibernate.hbm2ddl.auto" value="update" />    

                 <property name="hibernate.show_sql" value="false" />

                 <property name="hibernate.format_sql" value="true" />

            </properties>

        </persistence-unit>

      </persistence>

       

      Thanks.