【问题标题】:Fuse ESB: Bundle with mina cannot be deployed in ServiceMixFuse ESB:无法在 ServiceMix 中部署带有 mina 的捆绑包
【发布时间】:2012-03-14 04:16:16
【问题描述】:

我正在尝试在 fuse esb 上使用 apache mina 和骆驼。我正面临部署问题。

这是我的路线:

<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>

下面是从 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();
    }
}

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

【问题讨论】:

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


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-03-30
      • 1970-01-01
      • 1970-01-01
      • 2012-05-17
      • 2011-05-30
      • 2011-06-19
      • 2014-03-04
      相关资源
      最近更新 更多