title: Spring, Websphere, JMS and Eclipselink Issue
body: <p>I have an application that runs inside of Websphere, and I am having an issue with persisting JPA entities.</p>
  
  <p>Previously, the application was setup with RESOURCE_LOCAL persistence units, with the Spring JpaTransactionManager, and transactions that were committed explicitly in code.</p>
  
  <pre><code>  TransactionStatus transactionStatus = transactionManager.getTransaction( new DefaultTransactionDefinition() );
    try {
       entityManager.persist( someJpaEntity );
    }
    catch( Exception exception ) {
       transactionManager.rollback( transactionStatus );
       throw exception;
    }
    try {
       transactionManager.commit( transactionStatus );
    }
    catch( TransactionException exception ) {
       exception
    }
  </code></pre>
  
  <p>I am working on an enhancement to the application that will allow calls through a Message Driven Pojo linked to a Websphere Queue.  I was able to setup a configuration through spring that will allow my application to receive messages through a JMS queue.  The spring config looks like:</p>
  
  <pre><code>&lt;jee:jndi-lookup id="jmsConnectionFactory" jndi-name="QueueConnectionFactory"/&gt;
  &lt;jee:jndi-lookup id="jmsQueue" jndi-name="DIQueue" /&gt;
  
  &lt;!-- A dynamic resolver --&gt;
  &lt;bean id="jmsDestResolver" class="org.springframework.jms.support.destination.DynamicDestinationResolver"/&gt; 
  
  &lt;bean id="jmsQueueTemplate" class="org.springframework.jms.core.JmsTemplate"&gt;
     &lt;property name="connectionFactory"&gt;
        &lt;ref bean="jmsConnectionFactory"/&gt;
     &lt;/property&gt;
     &lt;property name="destinationResolver"&gt;
        &lt;ref bean="jmsDestResolver"/&gt;
     &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="messageListener" class="my.app.FileMessageListener" /&gt;
  
  &lt;bean id="exListener" class="my.app.JmsExceptionListener" /&gt;
  
  &lt;bean id="msgListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"&gt;
    &lt;property name="connectionFactory" ref="jmsConnectionFactory" /&gt;
    &lt;property name="destination" ref="jmsQueue" /&gt;
    &lt;property name="messageListener" ref="messageListener" /&gt;
    &lt;property name="transactionManager" ref="transactionManager" /&gt;
    &lt;property name="taskExecutor" ref="myTaskExecutor" /&gt;
    &lt;property name="exceptionListener" ref="exListener" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="myTaskExecutor" class="org.springframework.scheduling.commonj.WorkManagerTaskExecutor"&gt;
    &lt;property name="workManagerName" value="wm/default" /&gt;
  &lt;/bean&gt; 
  </code></pre>
  
  <p>Not sure if there is an issue with my spring setup, but I do receive messages through my Active MQ broker, so that part I seem to be good with.</p>
  
  <p>Now, the issue is, that when I get a message in through JMS, I would call the above code to insert the JPA entity.  When the code would run, I would get the message "unable to commit a one phase resource in a two phase transaction", or something similar.  What I came to understand is that the Spring JpaTransactionManager does not work with XA or JTA transactions.</p>
  
  <p>So, I worked on moving to the Spring JtaTransactionManager.</p>
  
  <p>I changed everything I Could think of over to use JTA, here is where I declare my transaction manager:</p>
  
  <pre><code>&lt;bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/&gt;
  </code></pre>
  
  <p>Updated my persistence XML:</p>
  
  <pre><code>&lt;persistence-unit name="AppUnit" transaction-type="JTA"&gt;        
      &lt;provider&gt;oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider&lt;/provider&gt;
      &lt;jta-data-source&gt;java:APPDS&lt;/jta-data-source&gt; 
  </code></pre>
  
  <p>And still, nothing works.  My code runs without exception, but nothing gets persisted to the database.  The message gets pulled off of the JMS Queue, but no data.</p>
  
  <p>Any suggestions?</p>