1 Reply Latest reply on Sep 20, 2011 4:54 AM by Viggo Navarsete

    Problem with persistence.xml

    Viggo Navarsete Expert

      I get this when I run the test (using embedded Jboss 6):

      Specification violation [EJB3 JPA 6.2.1.2] - You have not defined a non-jta-data-source for a RESOURCE_LOCAL enabled persistence context named: integration

       

      My persistence.xml (located in src/test/resources/META-INF) contains this:

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

      <persistence version="1.0" 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_1_0.xsd">

          <persistence-unit name="integration" transaction-type="RESOURCE_LOCAL">   

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

                    <!--non-jta-data-source>WHAT SHOULD I PUT HERE???</non-jta-data-source-->

              <class>com.tracetracker.tix.domain.AbstractNodeData</class>

              <class>com.tracetracker.tix.domain.BizTrans</class>

              <class>com.tracetracker.tix.domain.EPC</class>

              <class>com.tracetracker.tix.domain.Event</class>

              <class>com.tracetracker.tix.domain.Extension</class>

              <class>com.tracetracker.tix.domain.ExtensionAttr</class>

              <class>com.tracetracker.tix.domain.GlobalLink</class>

              <class>com.tracetracker.tix.domain.Vocabulary</class>

              <class>com.tracetracker.tix.domain.VocabularyElement</class>

              <exclude-unlisted-classes>true</exclude-unlisted-classes>

             

              <!--  HSQLDB properties -->

              <properties>

                  <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>

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

                  <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>

                  <property name="hibernate.connection.username" value="sa"/>

                  <property name="hibernate.connection.password" value=""/>

                  <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:tix"/>

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

              </properties>

          </persistence-unit>

      </persistence>

       

      Question: What should I put in the non-jta-data-source? And if I have to provide a data source, how do I do it?

       

      My deployment from the test looks like this:


      @Deployment

      public static JavaArchive createTestArchive() {


      return ShrinkWrap




      .create( JavaArchive.class, "test.jar" )




      .addClasses( VocabularyServiceBrowser.class, VocabularyServiceImpl.class,






      CrudService.class )




      .addAsManifestResource( EmptyAsset.INSTANCE, ArchivePaths.create( "beans.xml" ) )




      .addAsManifestResource("META-INF/persistence.xml", "persistence.xml");

      }