2016-08-16 5 views
0

Я запускаю Mule 3.6.2 в STS 3.6.4. Я пытаюсь использовать простой компонент Java.mule java component throwing IllegalArgumentException

public class MyComponent implements Callable { 

    public MyComponent() { 
    super(); 
    } 

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

и простой поток в фазе ввода Batch компонента ....

<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 компонент линии, я получаю

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] 

Я знаю, что такое средство исключения , но не в состоянии понять в этом контексте.

+0

Не могли бы вы разместить полный стек? – jvas

ответ

0

Если вы хотите создать простой компонент java, то вместо реализации вызываемого, попробуйте с mule specific аннотации.

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

}

Ура!

+0

Это будет работать, за исключением того, что мне нужен доступ к MuleEventContext :( – Jeet

+0

Что вы хотите получить из eventcontext? –

+0

@jeet вы можете использовать ** @ Groovy («eventContext») ** как один из параметров метода, чтобы выйти что-то из MuleEventContext. –

Смежные вопросы