Fuse ESB:无法在ServiceMix中部署与mina捆绑

时间:2012-03-14 04:16:17

标签: apache-camel esb apache-servicemix fuseesb apache-mina

我正在尝试使用带有骆驼的apache mina on fuse esb。我正面临部署问题。

这是我的路线:

<beans xmlns...
    <bean id="myCodec" class="test.net.mina.codec.MyMinaCodec" />
    <camelContext xmlns="http://camel.apache.org/schema/spring">
        <route>
            <from uri="mina:tcp://localhost:3100?sync=false&amp;codec=#myCodec" />
            <to uri="activemq://Test.IncomingMsg" />
        </route>
    </camelContext>
</beans>

Bellow是从servicemix控制台获取的堆栈跟踪:

Exception in thread "SpringOsgiExtenderThread-18" org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route8: Route[[From[mina:tcp://localhost:3100?sync=false&codec=#myCo... because of Failed to resolve endpoint: mina://tcp://localhost:3100?codec=%23myCodec&sync=false due to: Could not find a suitable setter for property: codec as there isn't a setter method with same type: test.net.mina.codec.MyMinaCodec nor type conversion possible: No type converter available to convert from type: test.net.mina.codec.MyMinaCodec to the required type: org.apache.mina.filter.codec.ProtocolCodecFactory with value test.net.mina.codec.MyMinaCodec@8073d3
    at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1149)
    at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:110)
    at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:240)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
    at org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)
    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)
    at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
    at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
    at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route8: Route[[From[mina:tcp://localhost:3100?sync=false&codec=#myCo... because of Failed to resolve endpoint: mina://tcp://localhost:3100?codec=%23myCodec&sync=false due to: Could not find a suitable setter for property: codec as there isn't a setter method with same type: test.net.mina.codec.MyMinaCodec nor type conversion possible: No type converter available to convert from type: test.net.mina.codec.MyMinaCodec to the required type: org.apache.mina.filter.codec.ProtocolCodecFactory with value test.net.mina.codec.MyMinaCodec@8073d3
    at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:170)
    at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:698)
    at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1679)
    at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1464)
    at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1356)
    at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:169)
    at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
    at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
    at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1324)
    at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:213)
    at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:108)
    ... 10 more
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: mina://tcp://localhost:3100?codec=%23myCodec&sync=false due to: Could not find a suitable setter for property: codec as there isn't a setter method with same type: test.net.mina.codec.MyMinaCodec nor type conversion possible: No type converter available to convert from type: test.net.mina.codec.MyMinaCodec to the required type: org.apache.mina.filter.codec.ProtocolCodecFactory with value test.net.mina.codec.MyMinaCodec@8073d3
    at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:444)
    at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:48)
    at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:180)
    at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:110)
    at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:116)
    at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
    at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:88)
    at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:798)
    at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:165)
    ... 20 more
Caused by: java.lang.IllegalArgumentException: Could not find a suitable setter for property: codec as there isn't a setter method with same type: test.net.mina.codec.MyMinaCodec nor type conversion possible: No type converter available to convert from type: test.net.mina.codec.MyMinaCodec to the required type: org.apache.mina.filter.codec.ProtocolCodecFactory with value test.net.mina.codec.MyMinaCodec@8073d3
    at org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:341)
    at org.apache.camel.util.EndpointHelper.setReferenceProperties(EndpointHelper.java:250)
    at org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:199)
    at org.apache.camel.component.mina.MinaComponent.createEndpoint(MinaComponent.java:92)
    at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:75)
    at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:426)
    ... 28 more

这是我的编解码器工厂:

public class MyMinaCodec implements ProtocolCodecFactory {

    public ProtocolDecoder getDecoder(IoSession session) throws Exception {
        return new MyMinaDecoder();
    }

    public ProtocolEncoder getEncoder(IoSession session) throws Exception {
        return new MyMinaEncoder();
    }
}

知道我在这里做错了什么吗?谢谢你的帮助

1 个答案:

答案 0 :(得分:0)

好吧,我的坏!我忘了在pom.xml中为maven指定所需的包:

<Require-Bundle>org.apache.servicemix.bundles.mina</Require-Bundle>