2011-10-06 1032 views
0

我有部署到WebSphere 7.每次我试图访问一个网址我收到此错误消息RESTful Web服务问题:WLTC0017E:资源回滚由于使用setRollbackOnly()被调用错误

"WLTC0017E: Resources rolled back due to setRollbackOnly() being called". 

我怀疑我的间接查找是问题的原因。我有我这样的代码

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); 

    } 

除此之外,我创建了我的数据源并使用WebSphere成功测试过。我做错的邪恶是什么?

这里是我的堆栈跟踪:

[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 
+1

日志中是否存在其他可能解释回滚的错误(例如事务超时)?我唯一的建议是从servlet请求处理中删除一些位,直到缩小什么代码调用了setRollbackOnly为止。 –

回答

1

你最有可能看到的事务超时。你应该做的是确保你的应用程序提交更改。你也可以增加WAS的数据库超时。你可以在“交易服务”下找到它们。