【问题标题】:Oracle Streams AQ. session.getQueue throwing AQOracleSQLException: Exhausted ResultsetOracle Streams AQ。 session.getQueue 抛出 AQOracleSQLException:用尽的结果集
【发布时间】:2011-04-06 00:30:38
【问题描述】:

在多线程/多应用程序环境中使用 Oracle Streams AQ 我收到了一个 AQOracleSQLException: Exhausted Resultsset,仅在一个线程中运行大约 10 分钟后。

oracle.AQ.AQOracleSQLException: Exhausted Resultset
        at oracle.AQ.AQOracleSession.getQueue(AQOracleSession.java:751)
        at au.com.xxx.queue.OracleQueue$$anonfun$2.apply(OracleQueue.scala:53)

AQOracleSession 通过 Spring 汇集如下:

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="jdbc/MessageManagerDB"/>
</bean>

<bean id="aqSessionFactory" class="au.com.xxx.queue.AQSessionFactory">
    <constructor-arg ref="dataSource"/>
</bean>

<bean id="aqSessionTarget" factory-bean="aqSessionFactory" 
    factory-method="createAQSession" scope="prototype"/>

<bean id="aqSessionPoolTargetSource" 
    class="org.springframework.aop.target.CommonsPoolTargetSource">
    <property name="targetBeanName" value="aqSessionTarget"/>
    <property name="maxSize" value="25"/>
</bean>

<bean id="aqSession" class="org.springframework.aop.framework.ProxyFactoryBean">
    <property name="targetSource" ref="aqSessionPoolTargetSource"/>
</bean>

使用工厂方法 createAQSession(在 Scala 中):

def createAQSession = {
  val wasConnection = dataSource.getConnection.asInstanceOf[WSJdbcConnection]
  val connection = WSCallHelper.getNativeConnection(wasConnection).asInstanceOf[Connection]
  SessionWithConnection(AQDriverManager.createAQSession(connection), connection)
  // SessionWithConnection is just a case class akin to 
  // Tuple2[AQOracleSession, Connection]
}

异常是从this块的最后一行抛出的:

def sessionAndConnection = {
  applicationContext.getBean("aqSession").asInstanceOf[SessionWithConnectionI]
}

def write(category: String, relatedId: Option[String], payload: String): Array[Byte] = {
  val (session, conn) = {
    val sc = sessionAndConnection
    (sc.session, sc.connection)
  }
  val queueDef = dao.queueForWriting(category, relatedId).map{_.name}
  val queue = queueDef.map{name => session.getQueue("QUSR", name)}

显然,我没有直接处理AQOracleSession 中使用的ResultSet

am 使用与 Session 关联的 Connection,但这直到稍后才使用相同的方法,因此这里不能出错:

val clob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION)

是否有可能是池配置不正确并且同一会话上有一些并发操作?其他日志中没有任何异常。

【问题讨论】:

    标签: spring stream pooling oracle-aq


    【解决方案1】:

    这是我错误使用的 v10 驱动程序的一个缺陷。 v11 RDBMS 驱动没有这个问题。

    【讨论】:

      猜你喜欢
      • 2011-01-27
      • 2016-05-04
      • 2011-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多