2016-11-18 2 views
0

Ich habe ein Problem "keine Transaktion läuft" für containerbasierte Datenquelle in Wildfly 10.1.DeltaSpike Daten und JTA funktioniert nicht

Es sind meine Einstellungen:

<datasource jta="true" jndi-name="java:jboss/datasources/MY_DATASOURCE" pool-name="MY_DATASOURCE_POOL" enabled="true" use-java-context="true" use-ccm="true" statistics-enabled="true"> 
       <connection-url>jdbc:postgresql://localhost:5432/test</connection-url> 
       <driver>postgresql</driver> 
       <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> 
       <pool> 
        <min-pool-size>50</min-pool-size> 
        <max-pool-size>150</max-pool-size> 
       </pool> 
       <security> 
        <user-name>test</user-name> 
        <password>test</password> 
       </security> 
       <validation> 
        <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/> 
        <validate-on-match>true</validate-on-match> 
        <background-validation>true</background-validation> 
        <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/> 
       </validation> 
      </datasource> 

Wir persistence.xml nicht verwenden, so ist es mein hibernate.cfg.xml ist

<!DOCTYPE hibernate-configuration PUBLIC 
      "-//Hibernate/Hibernate Configuration DTD//EN" 
      "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> 
    <hibernate-configuration> 
     <session-factory> 
      <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQL95Dialect</property> 
      <property name="hibernate.transaction.jta.platform">org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform</property> 
      <property name="hibernate.show_sql">true</property> 
      <property name="hibernate.format_sql">true</property> 
      <!-- Configuration for multitenancy separate database support --> 
      <property name="hibernate.multiTenancy">DATABASE</property> 
      <property name="hibernate.tenant_identifier_resolver">org.example.TenantResolver</property> 
     </session-factory> 
    </hibernate-configuration> 

Auch habe ich Apache-deltaspike .properties Datei mit der Zeile

globalAlternatives.org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy=org.apache.deltaspike.jpa.impl.transaction.ContainerManagedTransactionStrategy 

für die Unterstützung der Transaktionsstrategie im Container. Aber leider in meinem @Stateless Service habe ich noch keine Transaktionen. Kann mir jemand einen Rat geben, was mit meiner Konfiguration nicht stimmt?

Antwort

0

Stellen Sie sicher, dass Sie die Linie

<property name="hibernate.transaction.coordinator_class">jta</property> 

in hibernate.cfg.xml hinzufügen und Sie haben auch die Umsetzung von javax.interceptor.InvocationContext in Ihrem Classpath im gleichen Fall wie meine.

Verwandte Themen