2
我正在使用Camel sql組件來針對Oracle DB運行選擇查詢。戰爭文件部署在Jboss EAP 6.1上。在配置下的配置文件中,我將track-statements設置爲true(即true)。因此,當連接返回到池時,Jboss檢查結果集是否關閉。Apache Camel SQL組件未關閉結果集?
我配置SQL組件,如下所示:
//datasource is injected here
@Resource(mappedName = "java:/jdbc/OracleDS")
private DataSource dataSource;
... ...
//SQL component
SqlComponent sqlComponent = new SqlComponent();
sqlComponent.setDataSource(dataSource);
camelCtx.addComponent("sql", sqlComponent);
SQL組件是在recipientList使用方法如下:
from("activemq:"+queue)
...
.recipientList(simple(getFromConfig(sqlStmtName)),"false")
..
sql語句沒什麼特別的。只需要一張表格中的常規選擇語句。
在Jboss日誌中,我看到此警告。
2015-04-16 16:23:07,169 WARN [org.jboss.jca.adapters.jdbc.WrappedConnection] (ajp-8009-2|R:r2K4crKLnPRT-0br|ctvc|1.0) Closing a result set you left open! Please close it yourself.: java.lang.Throwable: STACKTRACE
at org.jboss.jca.adapters.jdbc.WrappedStatement.registerResultSet(WrappedStatement.java:1357)
at org.jboss.jca.adapters.jdbc.WrappedStatement.getResultSet(WrappedStatement.java:740)
at org.apache.camel.component.sql.SqlProducer$2.doInPreparedStatement(SqlProducer.java:127)
at org.apache.camel.component.sql.SqlProducer$2.doInPreparedStatement(SqlProducer.java:90)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:589)
at org.apache.camel.component.sql.SqlProducer.process(SqlProducer.java:90)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:573)
at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:506)
at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:215)
at org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:167)
at org.apache.camel.processor.RecipientList.process(RecipientList.java:120)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
...
...
我檢查SqlProducer.java(線127)。由於sql組件使用Spring JDBCtemplate,我會假設結果集將被模板關閉。
有什麼我需要做的關閉結果集?
感謝克勞斯。我會看看使用更新版本的駱駝。 – vaidy