【问题标题】:Failed to instantiate PooledConnectionFactory NoSuchMethodFound ActiveMq 5.8.0无法实例化 PooledConnectionFactory NoSuchMethodFound ActiveMq 5.8.0
【发布时间】:2019-05-11 03:05:04
【问题描述】:

我在JBoss上安装了activemq 5.8.0 fuse jms 1.1也安装了commons pool 1.6也安装了,项目报这个错误

Application context refresh failed (OsgiBundleXmlApplicationContext (bundle=octopus-agency-nipost-service, config=osgibundle:/META-INF/spring/*.xml))

org.apache.camel.RuntimeCamelException: java.lang.RuntimeException:
    Failed to instantiate PooledConnectionFactory: java.lang.NoSuchMethodException:
    org.apache.activemq.pool.PooledConnectionFactory.<init>(org.apache.activemq.ActiveMQConnectionFactory)
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1326)
    [130:org.apache.camel.camel-core:2.10.0.redhat-60024]
at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:120)
    [137:org.apache.camel.camel-spring:2.10.0.redhat-60024]
at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:283)
    [137:org.apache.camel.camel-spring:2.10.0.redhat-60024]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
    [106:org.springframework.context:3.1.3.RELEASE

以下依赖项是与抛出上述错误的项目一起编译的。

<dependency> 
    <groupId>org.apache.activemq</groupId> 
    <artifactId>activemq-camel</artifactId> 
    <version>5.8.0.redhat-60024</version> 
</dependency> 

<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-pool</artifactId>
    <!-- lets use JMS 2.0 api but camel-jms still works with ActiveMQ 5.x that is JMS 1.1 only -->
    <exclusions>
        <exclusion>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-jms_1.1_spec</artifactId>
        </exclusion>
    </exclusions>
    <version>5.8.0.redhat-60024</version>
</dependency>

<!-- xbean is required for ActiveMQ broker configuration in the spring xml file -->
<dependency>
    <groupId>org.apache.xbean</groupId>
    <artifactId>xbean-spring</artifactId>
    <version>4.12</version>
</dependency>

<!-- https://mvnrepository.com/artifact/javax.jms/jms -->
<dependency>
    <groupId>javax.jms.local</groupId>
    <artifactId>jms-local</artifactId>
    <version>1.1</version>
</dependency>

【问题讨论】:

  • 你肯定有版本问题。我会尝试向上或向下更改版本以尝试找到该方法的实现位置。
  • @JoaoEsperancinha 是的,我猜得差不多了,它可能来自 commons-pool 版本 1.6,但根据研究,它说 1.6 适用于 activemq 5.8.0。我要提高两个版本吗?
  • 您需要继续尝试或查看该方法所在的 API 以及实现该方法的库。谷歌搜索它可能会有所帮助。在这些情况下,想到的一件事是找出您缺少哪种方法。尝试调试 ObjectHelper.java:1326 看看你能找到什么。

标签: java jboss activemq


【解决方案1】:

验证你的 ActiveMQ 的版本和你在 pom.xml 中的依赖配置

<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-camel</artifactId>
    <version>5.15.13</version>
</dependency>

验证这些是否相同。

【讨论】:

    猜你喜欢
    • 2011-10-08
    • 2012-06-23
    • 2023-03-16
    • 2014-10-12
    • 2016-06-04
    • 2022-01-03
    • 2018-06-27
    • 2016-06-09
    • 2020-10-26
    相关资源
    最近更新 更多