我正在尝试使用Liberty Profile中的JSR-352实现,并且被“ORA-01002”难以接受:取消序列'读者处理JDBC ResultSet的前10项后出错。我的块大小设置为100.
这是我的读者:
com.ibm.jbatch.container.exception.BatchContainerRuntimeException: Failure in Read-Process-Write Loop
at com.ibm.jbatch.container.controller.impl.ChunkStepControllerImpl.invokeChunk(ChunkStepControllerImpl.java:702)
at com.ibm.jbatch.container.controller.impl.ChunkStepControllerImpl.invokeCoreStep(ChunkStepControllerImpl.java:792)
at com.ibm.jbatch.container.controller.impl.BaseStepControllerImpl.execute(BaseStepControllerImpl.java:292)
at com.ibm.jbatch.container.controller.impl.ExecutionTransitioner.doExecutionLoop(ExecutionTransitioner.java:118)
at com.ibm.jbatch.container.controller.impl.WorkUnitThreadControllerImpl.executeCoreTransitionLoop(WorkUnitThreadControllerImpl.java:94)
at com.ibm.jbatch.container.controller.impl.WorkUnitThreadControllerImpl.executeWorkUnit(WorkUnitThreadControllerImpl.java:155)
at com.ibm.jbatch.container.controller.impl.WorkUnitThreadControllerImpl$AbstractControllerHelper.runExecutionOnThread(WorkUnitThreadControllerImpl.java:480)
at com.ibm.jbatch.container.controller.impl.WorkUnitThreadControllerImpl.runExecutionOnThread(WorkUnitThreadControllerImpl.java:90)
at com.ibm.jbatch.container.util.BatchWorkUnit.run(BatchWorkUnit.java:117)
at com.ibm.ws.context.service.serializable.ContextualRunnable.run(ContextualRunnable.java:80)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.ibm.jbatch.container.exception.BatchContainerRuntimeException: java.sql.SQLException: ORA-01002: fetch out of sequence
at com.ibm.jbatch.container.controller.impl.ChunkStepControllerImpl.readItem(ChunkStepControllerImpl.java:354)
at com.ibm.jbatch.container.controller.impl.ChunkStepControllerImpl.readAndProcess(ChunkStepControllerImpl.java:245)
at com.ibm.jbatch.container.controller.impl.ChunkStepControllerImpl.invokeChunk(ChunkStepControllerImpl.java:626)
... 14 more
Caused by: java.sql.SQLException: ORA-01002: fetch out of sequence
如果在open()方法中发生ResultSet处理,那么我不会遇到任何错误。
这是我的server.xml中的batchPersistence配置:
@model IEnumerable<GPBuddy.DataContexts.Item.History>
@{
String arr = "";
foreach (var item in Model)
{
arr += item.current_price_raw.ToString() + ",";
}
arr = arr.TrimEnd(',');
}
<div id="testData">
</div>
<script type="text/javascript">
var array = '@arr';
var prices = array.split(",");
text = "<ul>"
for (i = 0; i < prices.length; i++) {
text += "<li>" + prices[i] + "</li>";
}
text += "</ul>";
document.getElementById("test").innerHTML = text;
</script>
以下是职位日志中的错误:
<div id="testData">
</div>
<script type="text/javascript">
var array = '2051,2034,1908,1908,1887,1887,1680,1610,1549,1452,1411,1421,1439,1464,1533,1608,1763,1958,2027,2070,2077,2043,2026,2026,2013';
var prices = array.split(",");
text = "<ul>"
for (i = 0; i < prices.length; i++) {
text += "<li>" + prices[i] + "</li>";
}
text += "</ul>";
document.getElementById("test").innerHTML = text;
</script>
如果它们有用,我还有其他日志等。提前谢谢。
答案 0 :(得分:2)
不要跨线程缓存JDBC Statement或ResultSet实例。 JDBC编程模型不支持多线程访问,这可能是您遇到此错误的原因。还有为什么它在open方法中运行良好,open方法在单个线程上运行。使用JDBC时,可以缓存DataSource,但不能连接Connection或Connection之下的任何内容。让应用服务器管理连接和语句的池,它以线程安全的方式执行。