无法链接oracle / jms / AQjmsGenMessage_C

时间:2016-02-08 18:26:44

标签: oracle oracle11g oracle-aq

我正在尝试使用Spring JDBC Extensions和Apache Camel链接AQ和JBOSS应用程序。我想我的Spring配置是正确的,但是当我使用oracleXE安装提供的ojdbc6aqapi jar运行它时,我得到以下错误

  

JBWEB000287:异常将上下文初始化事件发送到类的监听器实例org.springframework.web.context.ContextLoaderListener:org.springframework.beans.factory.BeanCreationException:创建类路径资源中定义的名为'aq'的bean时出错[camel -config.xml]:设置bean属性'connectionFactory'时无法解析对bean'connectionFactory'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'connectionFactory'的bean时出错:FactoryBean在创建对象时抛出异常;嵌套异常是java.lang.LinkageError:无法链接oracle / jms / AQjmsGenMessage_C

如果我将ojdbc6 jar换成ojdbc14,我会更进一步。但是,当打开连接时,它不是getConnection调用的正确版本。我怀疑这是由于不兼容的库,但证明我可能是正确的。

我们需要保留jndi数据源有三个原因

  1. 需要从保险库获取密码,这更容易
  2. 正如配置显示我们正在使用hibernate在同一连接上的同一数据库中进行额外处理,因此保持相同的数据连接是必不可少的
  3. 我们需要扩展,因此使用JBOSS数据源管理似乎是一个合理的选择。
  4. 关于此的任何想法都非常受欢迎。

    这是我的camel-context和春天配置

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:tx="http://www.springframework.org/schema/tx"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:orcl="http://www.springframework.org/schema/data/orcl"
           xmlns:jms="http://www.springframework.org/schema/jms"
           xmlns:camel="http://camel.apache.org/schema/spring"
           xmlns:jee="http://www.springframework.org/schema/jee"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/tx
           http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-3.0.xsd
           http://www.springframework.org/schema/data/orcl
           http://www.springframework.org/schema/data/orcl/spring-data-orcl-1.0.xsd
           http://www.springframework.org/schema/jms
           http://www.springframework.org/schema/jms/spring-jms-3.0.xsd
           http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
           http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
    
        <context:annotation-config/>
    
        <tx:annotation-driven/>
    
        <bean id="aq" class="org.apache.camel.component.jms.JmsComponent">
            <property name="connectionFactory" ref="connectionFactory" />
            <property name="transactionManager" ref="transactionManager" />
        </bean>
    
        <orcl:aq-jms-connection-factory id="connectionFactory" 
            use-local-data-source-transaction="true"
            native-jdbc-extractor="jbossNativeJdbcExtractor"
            data-source="jbossDataSource"  />
    
        <bean id="transactionManager"
              class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
            <property name="dataSource" ref="jbossDataSource"/>
        </bean>
    
        <bean id="jbossNativeJdbcExtractor" 
            class="org.springframework.jdbc.support.nativejdbc.JBossNativeJdbcExtractor"/>
    
        <jee:jndi-lookup id="jbossDataSource" jndi-name="cipDataSource"  />
    
    
      <camelContext trace="true" xmlns="http://camel.apache.org/schema/spring">
      <route>
        <from uri="servlet:///in"/>
        <choice>
          <when>
            <header>name</header>
            <transform>
              <simple>Hello ${header.name} how are you?</simple>
            </transform>
          </when>
          <otherwise>
            <transform>
              <constant>Add a name parameter to uri, eg ?name=foo</constant>
            </transform>
          </otherwise>
        </choice>
      </route>
      <route>
        <from uri="servlet:///tojms"/>
        <to pattern="InOnly" uri="aq:CIP.QSTART"/>
      </route>
    </camelContext>
    
    </beans>
    

    其他信息 通过跟踪ojdbc14.jar,我得到了

    AQjmsDBConnMgr ctor (datasource):  enter
     AQjmsDBConnMgr.getConnection:  Creating from datasource
     Fetching JDBC Connection from DataSource
     Unwrapping JDBC Connection of type:org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6
     Using Closeable Proxy fo JDBC Connection [oracle.jdbc.driver.T4CConnection@3ceb975]
     AQjmsDBConnMgr: constructor (datasource) org.springframework.data.jdbc.config.oracle.AqJmsFactoryBeanFactory$TransactionAwareDataSource@3da8acb9: 
    Exception: oracle.jms.AQjmsException: Error creating the db_connection
     oracle.jms.AQjmsException: Error creating the db_connection
    

    ojdbc6.jar没有跟踪信息,因为应用程序无法启动。

    Edit2:我换回ojdbc6.jar并注意到war文件在WEB-INF / lib文件夹中缺少此文件。正确添加它,现在与ojdbc14.jar具有相同的情况。

    我可以运行tojms servlet,但是通过getConnection提取连接也会遇到同样的问题。 stacktrace的相关部分似乎是

    oracle.jms.AQjmsException: Error creating the db_connection
        at oracle.jms.AQjmsDBConnMgr.getConnection(AQjmsDBConnMgr.java:625)
        at oracle.jms.AQjmsDBConnMgr.<init>(AQjmsDBConnMgr.java:399)
        at oracle.jms.AQjmsConnection.<init>(AQjmsConnection.java:249)
        at oracle.jms.AQjmsConnectionFactory.createConnection(AQjmsConnectionFactory.java:513)
        at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)
        at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:456)
        at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:180)
        at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:355)
        at org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:311)
        at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:109)
    

0 个答案:

没有答案