首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Camel HL7codec在Java中不工作

Camel HL7codec在Java中不工作
EN

Stack Overflow用户
提问于 2017-01-31 22:33:05
回答 1查看 372关注 0票数 0

我试图使用camel-hl7组件在camel中创建一个hl7侦听器。当我在骆驼泉上用同样的方法时,它还在起作用。但是当我尝试在Java中使用相同的内容时,如下所示,

代码语言:javascript
运行
复制
HL7MLLPCodec hl7codec = new HL7MLLPCodec();
        hl7codec.setCharset("iso-8859-1");
        camelContext.addRoutes(new RouteBuilder() {
            public void configure() {
                from("mina:tcp://localhost:4444?sync=true&codec=hl7codec").to("file://test");
            }
        });

它抛出异常,

org.apache.mina.filter.codec.ProtocolCodecFactory : java.lang.IllegalArgumentException:无法为属性: codec找到合适的设置器,因为没有相同类型的setter方法: java.lang.String或类型转换可能:没有可用的类型转换器将类型: java.lang.String转换为所需的类型:java.lang.String和值hl7codec!在org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:588)!在org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:616)!在org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:473)!在org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:483)!在org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:255)!在org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:257)!在org.apache.camel.component.mina.MinaComponent.createEndpoint(MinaComponent.java:92)!在org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:114)!在org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:568)!.33个普通帧省略了!原因: org.apache.camel.ResolveEndpointFailedException:未能解析端点: mina://tcp://localhost:4444?codec=hl7codec&sync=true,原因是:无法为属性找到合适的设置器:编解码器,因为没有具有相同类型的setter方法: java.lang.String或类型转换是可能的:无类型转换器可用于从类型: java.lang.String转换为所需的类型: org.apache.mina.filter.codec.ProtocolCodecFactory和值hl7codec!在org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:588)!在org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:79)

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-02-01 01:43:28

我必须将hl7codec注册到注册中心,才能使用骆驼路线。

代码语言:javascript
运行
复制
 final org.apache.camel.impl.SimpleRegistry registry = new org.apache.camel.impl.SimpleRegistry();
        final org.apache.camel.impl.CompositeRegistry compositeRegistry = new org.apache.camel.impl.CompositeRegistry();
        compositeRegistry.addRegistry(camelContext.getRegistry());
        compositeRegistry.addRegistry(registry);
        ((org.apache.camel.impl.DefaultCamelContext) camelContext).setRegistry(compositeRegistry);
    registry.put("hl7codec", hl7codec);

现在路线开始了。

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

https://stackoverflow.com/questions/41968720

复制
相关文章

相似问题

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