ServiceMix (FuseESB)—不能使用AggregationStrategy部署业务单元



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

应用程序的基础可以在这里找到。我修改了路由定义如下:

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 | ERROR | use-01-11/deploy | DefaultComponent
| ?? | 151 - servicemix-common -2011.02.1.创建名为'template'的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:name = org.apache.xbean.spring.context.FileSystemXmlApplicationContext@1c4d3b6url =[文件:/home/克丽丝/apache-servicemix-4.4.1-fuse-01-11/数据/jbi/tutorial-camel-sa sus tutorial-camel-su/)父母= [[org.apache.xbean.classloader。苏JarFileClassLoader: name =父类加载器url =[] parents=[231.0,BundleDelegatingClassLoader for [camel-spring][org.apache.camel.camel-spring], BundleDelegatingClassLoader for[camel-cxf (org.apache.camel.camel-cxf)], BundleDelegatingClassLoader查看[camel-cxf-transport (org.apache.camel.camel-cxf-transport)]]]]]]失败了;嵌套异常是java.lang.NoClassDefFoundError:org/apache/camel/processor/aggregate/AggregationStrategy 07:50:49,627| ERROR | use-01-11/deploy | ServiceAssemblyInstaller | ?
? [1.5.1. org.apache.servicemix.jbi.deployer]fuse-01-11 |部署SU tutorial-camel-su出错

不要使用JBI,它已经过时了。http://gnodet.blogspot.com/2010/12/thoughts-about-servicemix.html

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

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

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

相关内容

  • 没有找到相关文章

最新更新