简体   繁体   English

ule子Java组件抛出IllegalArgumentException

[英]mule java component throwing IllegalArgumentException

I am running Mule 3.6.2 in STS 3.6.4. 我正在STS 3.6.4中运行Mule 3.6.2。 I am trying to use a simple Java Component. 我正在尝试使用一个简单的Java组件。

public class MyComponent implements Callable {

   public MyComponent() {
    super();
   }

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

and a Simple flow in Input phase of Batch component.... 以及批处理组件输入阶段的简单流程。

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

At the java component line, I get a 在java组件行,我得到了一个

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]

I know what the exception means, but unable to understand in this context. 我知道异常的含义,但是在这种情况下无法理解。

If you want to create simple java component then instead of implementing callable, try with mule specific annotations. 如果要创建简单的Java组件,请尝试使用特定m子的注释,而不是实现可调用的。

public myComponent(){
   super();
}
public String myComponent(@payload String myPayload) {
  <!--your operation goes here--> 
 system.out.println("created my simple java component!"); 
 return myPayload;

} }

Cheers! 干杯!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM