首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >mule java组件抛出IllegalArgumentException

mule java组件抛出IllegalArgumentException
EN

Stack Overflow用户
提问于 2016-08-16 08:21:38
回答 1查看 194关注 0票数 0

我在STS 3.6.4中运行Mule 3.6.2。我正在尝试使用一个简单的Java组件。

代码语言:javascript
复制
public class MyComponent implements Callable {

   public MyComponent() {
    super();
   }

   @Override
   public Object onCall(MuleEventContext eventContext) throws Exception {
    return eventContext.getMessage().getPayload();
   }
}

以及Batch组件输入阶段的一个简单流程...

代码语言:javascript
复制
<flow name="MainFlow>
    <http:inbound-endpoint exchange-pattern="request-response" host="${app.host}" port="${app.port}" path="test" doc:name="HTTP"/>
    <cxf:jaxws-service serviceClass="example.sampleservice.TempService" doc:name="CXF"/>
    <component class="com.temp.MyComponent" doc:name="Java"/>
    <logger level="INFO" doc:name="Logger"/>
 </flow> 

在java组件行,我得到一个

代码语言:javascript
复制
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_75]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_75]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_75]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_75]
at org.mule.model.resolvers.AbstractEntryPointResolver.invokeMethod(AbstractEntryPointResolver.java:148) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.model.resolvers.MethodHeaderPropertyEntryPointResolver.invoke(MethodHeaderPropertyEntryPointResolver.java:109) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:36) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.component.DefaultComponentLifecycleAdapter.invoke(DefaultComponentLifecycleAdapter.java:339) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:82) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:73) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:125) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.component.AbstractComponent.access$000(AbstractComponent.java:59) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.component.AbstractComponent$1$1.process(AbstractComponent.java:241) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:94) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:69) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:50) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:69) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:22) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:66) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:61) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.component.AbstractComponent.process(AbstractComponent.java:159) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:94) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:69) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:102) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.module.cxf.CxfInboundMessageProcessor.processNext(CxfInboundMessageProcessor.java:389) ~[mule-module-cxf-3.6.2.jar:3.6.2]
at org.mule.module.cxf.MuleInvoker$1.process(MuleInvoker.java:88) ~[mule-module-cxf-3.6.2.jar:3.6.2]
at org.mule.module.cxf.MuleInvoker$1.process(MuleInvoker.java:84) ~[mule-module-cxf-3.6.2.jar:3.6.2]
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:16) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:30) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:14) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:54) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:50) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:28) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:13) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.execution.ErrorHandlingExecutionTemplate.execute(ErrorHandlingExecutionTemplate.java:59) ~[mule-core-3.6.2.jar:3.6.2]
at org.mule.module.cxf.MuleInvoker.invoke(MuleInvoker.java:83) ~[mule-module-cxf-3.6.2.jar:3.6.2]

我知道异常是什么意思,但在这种情况下无法理解。

EN

回答 1

Stack Overflow用户

发布于 2016-08-29 15:12:29

如果你想创建简单的组件而不是实现callable,可以尝试使用特定于java mule的java注解。

代码语言:javascript
复制
public myComponent(){
   super();
}
public String myComponent(@payload String myPayload) {
  <!--your operation goes here--> 
 system.out.println("created my simple java component!"); 
 return myPayload;

}

干杯!

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

https://stackoverflow.com/questions/38964864

复制
相关文章

相似问题

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