Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't make JTA work on jboss AS7.1 with spring 3.1
    text
    copied!<p>We're trying to configure a Spring application to work with JTA transactions. It is not like it is failing, but everything we tried just do the select and ignores our persistence operations.</p> <p>As you can see in the following logs, even though the save statement run there’s no insert statement, neither an exception, neither an error/warning logs</p> <p>server.log</p> <pre><code>DEBUG [xxxx.xxxx.persistence] (http--0.0.0.0-8080-1) execute $Proxy363.save(whatever.core.entities.XxxAssignedTime@51a8c542) DEBUG [org.springframework.data.repository.core.support.TransactionalRepositoryProxyPostProcessor$CustomAnnotationTransactionAttributeSource] (http--0.0.0.0-8080-1) Adding transactional method 'save' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; '' DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] (http--0.0.0.0-8080-1) Returning cached instance of singleton bean 'transactionManager' DEBUG [org.springframework.transaction.jta.JtaTransactionManager] (http--0.0.0.0-8080-1) Participating in existing transaction INFO [xxxx.xxxx.impl.BpmnUserBusinessImpl] (http--0.0.0.0-8080-1) Last Assigned Time Updated to *******, Thu Sep 06 15:48:48 ICT 2012 </code></pre> <p>It is like thought the application server thinks everything went right. Whereas if you check the table no insertion or update was made.</p> <p>The datasource that we intend to use with a spring application is successfully used with JTA transactions by a Java EE war application running in the same application server. </p> <p>Since we have no idea where the problem might be I'd like to put it all in full context.</p> <ul> <li>spring 3.1.2-RELEASE</li> <li>hibernate 4.1.5.Final</li> <li>spring-data-jpa 1.1.1.Final</li> <li>apache axis 1.4</li> <li>jboss AS7.1</li> <li>DB: oracle 10g</li> </ul> <p>We've been trying all sorts of crazy configuration in order to try to make it work, so I will just copy here the simplest one.</p> <p>standalone.xml</p> <pre><code>&lt;datasource jta="true" jndi-name="java:jboss/datasources/EngineDS" pool-name="EngineDS" enabled="true" use-java-context="true" use-ccm="true"&gt; &lt;connection-url&gt;jdbc:oracle:thin:@server:port:****&lt;/connection-url&gt; &lt;driver&gt;oracle&lt;/driver&gt; &lt;transaction-isolation&gt;TRANSACTION_READ_COMMITTED&lt;/transaction-isolation&gt; &lt;pool&gt; &lt;min-pool-size&gt;10&lt;/min-pool-size&gt; &lt;max-pool-size&gt;100&lt;/max-pool-size&gt; &lt;prefill&gt;true&lt;/prefill&gt; &lt;/pool&gt; &lt;security&gt; &lt;user-name&gt;****&lt;/user-name&gt; &lt;password&gt;****&lt;/password&gt; &lt;/security&gt; &lt;statement&gt; &lt;prepared-statement-cache-size&gt;32&lt;/prepared-statement-cache-size&gt; &lt;share-prepared-statements&gt;true&lt;/share-prepared-statements&gt; &lt;/statement&gt; &lt;/datasource&gt; &lt;drivers&gt; &lt;driver name="oracle" module="com.oracle.ojdbc6"&gt; &lt;xa-datasource-class&gt;oracle.jdbc.xa.client.OracleXADataSource&lt;/xa-datasource-class&gt; &lt;/driver&gt; &lt;/drivers&gt; </code></pre> <p>web.xml</p> <pre><code>[...] &lt;resource-ref id="DS"&gt; &lt;res-ref-name&gt;EngineDS&lt;/res-ref-name&gt; &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt; &lt;res-auth&gt;Container&lt;/res-auth&gt; &lt;res-sharing-scope&gt;Shareable&lt;/res-sharing-scope&gt; &lt;mapped-name&gt;java:jboss/datasources/EngineDS&lt;/mapped-name&gt; &lt;/resource-ref&gt; [...] </code></pre> <p>spring-jpa-config.xml</p> <pre><code>&lt;jpa:repositories base-package="whatever.core.repositories" /&gt; &lt;jee:jndi-lookup id="dataSource" jndi-name="EngineDS" cache="true" resource-ref="true" expected-type="javax.sql.DataSource"/&gt; &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;property name="packagesToScan" value="whatever.core.entities" /&gt; &lt;property name="jpaVendorAdapter"&gt; &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt; &lt;property name="showSql" value="${hibernate.show_sql}" /&gt; &lt;property name="generateDdl" value="${jpa.generateDdl}" /&gt; &lt;property name="databasePlatform" value="${jpa.dialect}" /&gt; &lt;/bean&gt; &lt;/property&gt; &lt;/bean&gt; &lt;tx:annotation-driven /&gt; &lt;tx:jta-transaction-manager /&gt; &lt;bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/&gt; &lt;bean class="org.springframework.orm.hibernate4.HibernateExceptionTranslator"/&gt; </code></pre> <p>We had made in the past jboss AS5/Spring 3.0 applications to work with JTA transactions, so it is not like is my first time doing this, and we've been looking around all possible blogs and open source projects I could find. Yet anything that seem to work smoothly to everybody seems to be ignored in my application. I'm sure it should be that we're missing something really stupid somewhere but we've tried so far 70+ different configurations and none seem do a simple insert that otherwise work when not trying JTA.</p> <p>(The fact that we use axis 1.4 might be relevant or not, but I'd like to tell because our application only triggers actions after a web service call). At this point we are starting to believe in configuration paranormal activity...</p> <p>Any clue anyone?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload