title: WLTC0017E:Resources rolled back due to setRollbackOnly() being called error
body: <p>I am having issue with a restful web service deployed on WebSphere 7. Each time I try to access a url I'm getting this error message:</p>
  
  <pre><code>"WLTC0017E: Resources rolled back due to setRollbackOnly() being called".
  </code></pre>
  
  <p>I am suspecting my indirect lookups as the cause of the problem. I have my look up code like this</p>
  
  <pre><code>try {
      this.em = (EntityManager) new InitialContext().lookup("java:comp/env/persistence/BACPOnlineAPPPU);
      this.utx = (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction");
      } catch (NamingException ex) {
          throw new RuntimeException(ex);
  
      }
  </code></pre>
  
  <p>Apart from this, I have created my datasource and tested successfully with WebSphere. What is the evil i am doing wrong?</p>
  
  <p>Here is my stack trace:</p>
  
  <pre><code>[10/6/11 10:21:26:888 WAT] 0000001d LocalTranCoor E   WLTC0017E: Resources rolled back due to setRollbackOnly() being called.
  [10/6/11 10:21:26:888 WAT] 0000001d webapp        E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[ServletAdaptor]: java.lang.RuntimeException: javax.transaction.RollbackException
      at com.tavia.service.PersistenceService.commitTx(PersistenceService.java:83)
      at com.tavia.service.GltmMisCodesResource.get(GltmMisCodesResource.java:63)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
      at java.lang.reflect.Method.invoke(Method.java:611)
      at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:149)
      at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
      at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:259)
      at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83)
      at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
      at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71)
      at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:990)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:941)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:932)
      at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:384)
      at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:451)
      at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:632)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
      at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
      at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3935)
      at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
      at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
      at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
      at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
      at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
      at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
      at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
      at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
      at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
      at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
      at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
      at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
      at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
  Caused by: javax.transaction.RollbackException
      at com.ibm.tx.jta.TransactionImpl.stage3CommitProcessing(TransactionImpl.java:1224)
      at com.ibm.tx.jta.TransactionImpl.processCommit(TransactionImpl.java:998)
      at com.ibm.tx.jta.TransactionImpl.commit(TransactionImpl.java:919)
      at com.ibm.ws.tx.jta.TranManagerImpl.commit(TranManagerImpl.java:436)
      at com.ibm.tx.jta.TranManagerSet.commit(TranManagerSet.java:161)
      at com.ibm.ws.tx.jta.UserTransactionImpl.commit(UserTransactionImpl.java:293)
      at com.tavia.service.PersistenceService.commitTx(PersistenceService.java:81)
      ... 41 more
  </code></pre>