【问题标题】:ServiceMix (FuseESB) - Cannot deploy service unit with AggregationStrategyServiceMix (FuseESB) - 无法使用 AggregationStrategy 部署服务单元
【发布时间】:2012-01-19 02:34:08
【问题描述】:

我正在尝试将非常简单的 ESB 应用程序部署到 Apache ServiceMix (Fuse ESB),并且在我尝试使用“AggregationStrategy”接口之前一切正常。我正在使用 EIP 和聚合器模式构建概念证明,并且由于 NoClassDefFound 错误而无法部署我的工件。看起来像一个典型的类加载问题,但我不知道如何解决它。我都尝试过:向我的服务单元添加和删除骆驼核心依赖项(servicemix-camel 类型)。

应用程序的基础可以找到here。我已将路线定义修改为以下内容:

public void configure() {
        from("activemq:test2").split(xpath("/notes/note")).parallelProcessing().process(new NoteProcessor()).to("activemq:test3");

        from("activemq:test3").aggregate(header("id"), new MyAggregationStrategy()).completionTimeout(3000).to("activemq:test");
    }

我的自定义 AggregationStrategy 如下所示:

package com.softwarepassion.tutorial.camel;

import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.processor.aggregate.AggregationStrategy;

public class MyAggregationStrategy implements AggregationStrategy {

    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
        Message newIn = newExchange.getIn();
        String oldBody = oldExchange.getIn().getBody(String.class);
        String newBody = newIn.getBody(String.class);
        newIn.setBody(oldBody + newBody);
        return newExchange;
    }
}

我在普通 ServiceMix 和 FuseESB 上遇到以下错误:

07:50:49,625 |错误 |使用-01-11/部署 |默认组件
| ? ? | 151-服务混合-常见- 2011.02.1.fuse-02-11 |创建名为“模板”的 bean 时出错:bean 初始化失败;嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名为“camel”的 bean:调用 init 方法失败; 嵌套异常是 org.springframework.beans.factory.BeanCreationException:错误 用名字创建bean 'com.softwarepassion.tutorial.camel.MyRouteBuilder':分辨率 在 bean 类上声明的构造函数 [com.softwarepassion.tutorial.camel.MyRouteBuilder] 来自 ClassLoader [[org.apache.xbean.classloader.JarFileClassLoader: 名称=org.apache.xbean.spring.context.FileSystemXmlApplicationContext@1c4d3b6 urls=[文件:/home/kris/apache-servicemix-4.4.1-fuse-01-11/data/jbi/tutorial-camel-sa/sus/tutorial-camel-su/] 父母=[[org.apache.xbean.classloader.JarFileClassLoader:名称=SU 父类加载器 urls=[] parents=[231.0, BundleDelegatingClassLoader 用于 [camel-spring (org.apache.camel.camel-spring)],BundleDelegatingClassLoader 用于 [camel-cxf (org.apache.camel.camel-cxf)],BundleDelegatingClassLoader [camel-cxf-transport (org.apache.camel.camel-cxf-transport)]]]]]] 失败的;嵌套异常是 java.lang.NoClassDefFoundError: org/apache/camel/处理器/聚合/聚合策略 07:50:49,627 |错误 |使用-01-11/部署 | ServiceAssemblyInstaller | ?
? | 147 - org.apache.servicemix.jbi.deployer - 1.5.1.fuse-01-11 | 部署 SU tutorial-camel-su 时出错

【问题讨论】:

    标签: java jbossfuse apache-servicemix fuseesb


    【解决方案1】:

    对于正在寻找上述问题的解决方案的任何人,我终于找到了here,我应该切换到 OSGI 类型的部署。您可以在 FuseESB 安装根目录的“examples”目录中找到工作的 camel-osgi 示例项目。

    【讨论】:

      【解决方案2】:

      不要使用 JBI,它是一个遗留/死的。 http://gnodet.blogspot.com/2010/12/thoughts-about-servicemix.html

      使用 Camel 原型创建一个新的 OSGi 项目以部署在 ServiceMix 中。原型列表在这里 http://camel.apache.org/camel-maven-archetypes.html

      例如camel-archetype-spring-dm 或camel-archetype-blueprint

      【讨论】:

      • 谢谢克劳斯,我开始使用 JBI 风格的 ServiceMix 主要是因为 ServiceMix 网站真的过时了,希望我早几天问这个问题并得到你的回复 :)
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-01-31
      • 2013-02-01
      • 2011-05-30
      • 2012-05-31
      • 1970-01-01
      • 2018-06-07
      • 1970-01-01
      相关资源
      最近更新 更多