我使用Camel sql组件对Oracle DB运行select查询。 war文件部署在Jboss EAP 6.1上。在配置下的配置文件中,我将track语句设置为true(即true)。因此,当连接返回到池时,Jboss会检查结果集是否已关闭。
我正在按如下方式配置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语句没什么特别的。只是来自单个表的常规select语句。
在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,我认为结果集将被模板关闭。
关闭结果集有什么需要做的吗?
答案 0 :(得分:3)
是的,这是Apache Camel中的一个错误。我已经记录了一张票,以便在将来的版本中修复此问题