首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ServiceMix (FuseESB) -不能使用AggregationStrategy部署服务单元

ServiceMix (FuseESB) -不能使用AggregationStrategy部署服务单元
EN

Stack Overflow用户
提问于 2011-12-13 07:03:21
回答 2查看 887关注 0票数 0

我正在尝试将非常简单的ESB应用程序部署到Apache ( ServiceMix,Fuse),所有这些都很好,直到我尝试使用'AggregationStrategy‘接口为止。我正在构建一个概念的证明,特别是使用EIP和聚合器模式,并且由于NoClassDefFound错误无法部署我的工件。看起来像典型的类加载问题,但我对如何解决这个问题没有什么想法。我尝试了这两种方法:向我的服务单元(servicemix-camel类型)添加和移除骆驼核心依赖项。

应用程序的基础可以找到这里。我已将我的路线定义修改如下:

代码语言:javascript
复制
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看起来是这样的:

代码语言:javascript
复制
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 \x\x\x{e76f}\\x{e76f}\{e76f}\x{e76f}使用-01-11/deploy= DefaultComponent 创建名为“模板”的bean的org.springframework.beans.factory.BeanCreationException:错误:初始化失败;嵌套异常是创建名为“camel”的bean :调用init方法失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:错误创建bean,其名称为'com.softwarepassion.tutorial.camel.MyRouteBuilder':,解析了ClassLoader [[org.apache.xbean.classloader.JarFileClassLoader: name=org.apache.xbean.spring.context.FileSystemXmlApplicationContext@1c4d3b6 urls=file:/home/kris/apache-servicemix-4.4.1-fuse-01-11/data/jbi/tutorial-camel-sa/sus/tutorial-camel中已声明的bean类com.softwarepassion.tutorial.camel.MyRouteBuilder上的构造函数。-su/ parents=[[org.apache.xbean.classloader.JarFileClassLoader: name=SU父类加载器urls=[] parents=[231.0,骆驼-弹簧BundleDelegatingClassLoader (org.apache.camel.camel-spring),骆驼-cxf(org.apache.camel.camel-cxf) BundleDelegatingClassLoader (org.apache.camel.camel-cxf),骆驼-cxf-传输BundleDelegatingClassLoader (org.apache.camel.camel-cxf-运输)];嵌套的例外是java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError 07:50:49,627 \x\x\x{e76f}\{e76f}\ ?\x{e76f}147-1.5.1.FUSE-01-11 org.apache.servicemix.jbi.deployer部署SU教程-camel-su错误

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-12-14 04:49:36

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

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

例如,骆驼原型-弹簧-dm或骆驼-原型-蓝图

票数 2
EN

Stack Overflow用户

发布于 2011-12-13 13:48:04

对于任何想要解决上述问题的人来说,我终于找到了这里,我应该切换到OSGI类型的部署。您可以在FuseESB安装的根目录的“示例”目录中找到运行中的camel示例项目。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8485498

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档