日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Mule学习笔记(二)

發布時間:2024/9/27 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Mule学习笔记(二) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Mule的第一個應用非常簡單。卻也可以看出Mule的運行機制。上例中,實現的是Hello world 的例子,過程為:用戶輸入內容,回車,然后顯示Hello,[輸入的內容]。這個實現非常簡單,但是,卻也存在一些問題,mule是怎么知道顯示這些內容的,現在就研究這個。

也許大家覺得,在XXXX.xml中已經配置了類路徑,mule當然可以找到這個類,問題就在這里,mule找到了實現類,那他是如何找到對應的方法的呢?OK,做一下嘗試

1、嘗試一

將inteface修改為:

[java] view plaincopyprint?
  • package demo.mule.umo;?
  • ?
  • public interface HelloWorld {?
  • ??? public String sayHello(String str);?
  • ??? public String sayHello();?
  • }?
  • package demo.mule.umo;public interface HelloWorld {public String sayHello(String str);public String sayHello(); }

    實現類修改為:

    [java] view plaincopyprint?
  • package demo.mule.umo.impl;?
  • import demo.mule.umo.HelloWorld;?
  • public class HelloWorldImpl implements HelloWorld {?
  • ??? @Override?
  • ??? public String sayHello(String str) {?
  • ??????? return "Hello," + str;?
  • ??? }?
  • ??? @Override?
  • ??? public String sayHello() {?
  • ??????? return "Hello world";?
  • ??? }?
  • }?
  • package demo.mule.umo.impl; import demo.mule.umo.HelloWorld; public class HelloWorldImpl implements HelloWorld {@Overridepublic String sayHello(String str) {return "Hello," + str;}@Overridepublic String sayHello() {return "Hello world";} }

    運行項目:運行成功!

    2、嘗試二

    修改interface為:

    [java] view plaincopyprint?
  • package demo.mule.umo;?
  • ?
  • public interface HelloWorld {?
  • ??? public String sayHello(String str);?
  • ??? public String sayHello2(String str);?
  • }?
  • package demo.mule.umo;public interface HelloWorld {public String sayHello(String str);public String sayHello2(String str); }

    修改實現類為:

    [java] view plaincopyprint?
  • package demo.mule.umo.impl;?
  • import demo.mule.umo.HelloWorld;?
  • public class HelloWorldImpl implements HelloWorld {?
  • ??? @Override?
  • ??? public String sayHello(String str) {?
  • ??????? return "Hello," + str;?
  • ??? }?
  • ??? @Override?
  • ??? public String sayHello2(String str) {?
  • ??????? return "Hello2 ," + str;?
  • ??? }?
  • }?
  • package demo.mule.umo.impl; import demo.mule.umo.HelloWorld; public class HelloWorldImpl implements HelloWorld {@Overridepublic String sayHello(String str) {return "Hello," + str;}@Overridepublic String sayHello2(String str) {return "Hello2 ," + str;} }

    運行:拋出ERROR

    [java] view plaincopyprint?
  • ERROR 2011-02-09 17:04:41,874 [HelloUMO.2] org.mule.service.DefaultServiceExceptionStrategy:??
  • ********************************************************************************?
  • Message?????????????? : [?
  • The required property "method" is not set on the event?
  • CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@12f1bf0" does not implement required interface "interface org.mule.api.lifecycle.Callable"?
  • Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}"?
  • Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}"?
  • ]?
  • Type????????????????? : org.mule.model.resolvers.EntryPointNotFoundException?
  • Code????????????????? : MULE_ERROR--2?
  • JavaDoc?????????????? : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html?
  • ********************************************************************************?
  • Exception stack is:?
  • 1. [?
  • The required property "method" is not set on the event?
  • CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@12f1bf0" does not implement required interface "interface org.mule.api.lifecycle.Callable"?
  • Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}"?
  • Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}"?
  • ] (org.mule.model.resolvers.EntryPointNotFoundException)?
  • ? org.mule.model.resolvers.DefaultEntryPointResolverSet:63 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html)?
  • ********************************************************************************?
  • Root Exception stack trace:?
  • org.mule.model.resolvers.EntryPointNotFoundException: [?
  • The required property "method" is not set on the event?
  • CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@12f1bf0" does not implement required interface "interface org.mule.api.lifecycle.Callable"?
  • Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}"?
  • Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}"?
  • ]?
  • ??? at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:63)?
  • ??? at org.mule.component.DefaultLifecycleAdapter.invoke(DefaultLifecycleAdapter.java:205)?
  • ??? at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:83)?
  • ??? at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:74)?
  • ??? at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:133)?
  • ??? at org.mule.component.AbstractComponent.invoke(AbstractComponent.java:161)?
  • ??? at org.mule.service.AbstractService.invokeComponent(AbstractService.java:929)?
  • ??? at org.mule.model.seda.SedaService.access$100(SedaService.java:56)?
  • ??? at org.mule.model.seda.SedaService$ComponentStageWorker.run(SedaService.java:574)?
  • ??? at org.mule.work.WorkerContext.run(WorkerContext.java:310)?
  • ??? at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)?
  • ??? at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)?
  • ??? at java.lang.Thread.run(Thread.java:619)?
  • ********************************************************************************?
  • ERROR 2011-02-09 17:04:41,874 [HelloUMO.2] org.mule.service.DefaultServiceExceptionStrategy: ******************************************************************************** Message : [ The required property "method" is not set on the event CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@12f1bf0" does not implement required interface "interface org.mule.api.lifecycle.Callable" Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" ] Type : org.mule.model.resolvers.EntryPointNotFoundException Code : MULE_ERROR--2 JavaDoc : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html ******************************************************************************** Exception stack is: 1. [ The required property "method" is not set on the event CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@12f1bf0" does not implement required interface "interface org.mule.api.lifecycle.Callable" Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" ] (org.mule.model.resolvers.EntryPointNotFoundException)org.mule.model.resolvers.DefaultEntryPointResolverSet:63 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html) ******************************************************************************** Root Exception stack trace: org.mule.model.resolvers.EntryPointNotFoundException: [ The required property "method" is not set on the event CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@12f1bf0" does not implement required interface "interface org.mule.api.lifecycle.Callable" Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" ]at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:63)at org.mule.component.DefaultLifecycleAdapter.invoke(DefaultLifecycleAdapter.java:205)at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:83)at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:74)at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:133)at org.mule.component.AbstractComponent.invoke(AbstractComponent.java:161)at org.mule.service.AbstractService.invokeComponent(AbstractService.java:929)at org.mule.model.seda.SedaService.access$100(SedaService.java:56)at org.mule.model.seda.SedaService$ComponentStageWorker.run(SedaService.java:574)at org.mule.work.WorkerContext.run(WorkerContext.java:310)at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)at java.lang.Thread.run(Thread.java:619) ********************************************************************************

    3、嘗試三

    修改interface:

    [java] view plaincopyprint?
  • package demo.mule.umo;?
  • ?
  • public interface HelloWorld {?
  • ??? public String sayHello();?
  • ??? public String sayHello2();?
  • }?
  • package demo.mule.umo;public interface HelloWorld {public String sayHello();public String sayHello2(); }

    修改實現類:

    [java] view plaincopyprint?
  • package demo.mule.umo.impl;?
  • import demo.mule.umo.HelloWorld;?
  • public class HelloWorldImpl implements HelloWorld {?
  • ??? @Override?
  • ??? public String sayHello() {?
  • ??????? return "Hello world";?
  • ??? }?
  • ??? @Override?
  • ??? public String sayHello2() {?
  • ??????? return "Hello2 world";?
  • ??? }?
  • }?
  • package demo.mule.umo.impl; import demo.mule.umo.HelloWorld; public class HelloWorldImpl implements HelloWorld {@Overridepublic String sayHello() {return "Hello world";}@Overridepublic String sayHello2() {return "Hello2 world";} }

    運行:拋出ERROR

    [java] view plaincopyprint?
  • ERROR 2011-02-09 17:07:27,811 [HelloUMO.2] org.mule.service.DefaultServiceExceptionStrategy:??
  • ********************************************************************************?
  • Message?????????????? : [?
  • The required property "method" is not set on the event?
  • CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@1f02b85" does not implement required interface "interface org.mule.api.lifecycle.Callable"?
  • Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}"?
  • Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}"?
  • ]?
  • Type????????????????? : org.mule.model.resolvers.EntryPointNotFoundException?
  • Code????????????????? : MULE_ERROR--2?
  • JavaDoc?????????????? : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html?
  • ********************************************************************************?
  • Exception stack is:?
  • 1. [?
  • The required property "method" is not set on the event?
  • CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@1f02b85" does not implement required interface "interface org.mule.api.lifecycle.Callable"?
  • Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}"?
  • Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}"?
  • ] (org.mule.model.resolvers.EntryPointNotFoundException)?
  • ? org.mule.model.resolvers.DefaultEntryPointResolverSet:63 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html)?
  • ********************************************************************************?
  • Root Exception stack trace:?
  • org.mule.model.resolvers.EntryPointNotFoundException: [?
  • The required property "method" is not set on the event?
  • CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@1f02b85" does not implement required interface "interface org.mule.api.lifecycle.Callable"?
  • Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}"?
  • Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}"?
  • ]?
  • ??? at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:63)?
  • ??? at org.mule.component.DefaultLifecycleAdapter.invoke(DefaultLifecycleAdapter.java:205)?
  • ??? at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:83)?
  • ??? at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:74)?
  • ??? at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:133)?
  • ??? at org.mule.component.AbstractComponent.invoke(AbstractComponent.java:161)?
  • ??? at org.mule.service.AbstractService.invokeComponent(AbstractService.java:929)?
  • ??? at org.mule.model.seda.SedaService.access$100(SedaService.java:56)?
  • ??? at org.mule.model.seda.SedaService$ComponentStageWorker.run(SedaService.java:574)?
  • ??? at org.mule.work.WorkerContext.run(WorkerContext.java:310)?
  • ??? at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)?
  • ??? at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)?
  • ??? at java.lang.Thread.run(Thread.java:619)?
  • ********************************************************************************?
  • ERROR 2011-02-09 17:07:27,811 [HelloUMO.2] org.mule.service.DefaultServiceExceptionStrategy: ******************************************************************************** Message : [ The required property "method" is not set on the event CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@1f02b85" does not implement required interface "interface org.mule.api.lifecycle.Callable" Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" ] Type : org.mule.model.resolvers.EntryPointNotFoundException Code : MULE_ERROR--2 JavaDoc : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html ******************************************************************************** Exception stack is: 1. [ The required property "method" is not set on the event CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@1f02b85" does not implement required interface "interface org.mule.api.lifecycle.Callable" Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" ] (org.mule.model.resolvers.EntryPointNotFoundException)org.mule.model.resolvers.DefaultEntryPointResolverSet:63 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html) ******************************************************************************** Root Exception stack trace: org.mule.model.resolvers.EntryPointNotFoundException: [ The required property "method" is not set on the event CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@1f02b85" does not implement required interface "interface org.mule.api.lifecycle.Callable" Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" ]at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:63)at org.mule.component.DefaultLifecycleAdapter.invoke(DefaultLifecycleAdapter.java:205)at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:83)at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:74)at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:133)at org.mule.component.AbstractComponent.invoke(AbstractComponent.java:161)at org.mule.service.AbstractService.invokeComponent(AbstractService.java:929)at org.mule.model.seda.SedaService.access$100(SedaService.java:56)at org.mule.model.seda.SedaService$ComponentStageWorker.run(SedaService.java:574)at org.mule.work.WorkerContext.run(WorkerContext.java:310)at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)at java.lang.Thread.run(Thread.java:619) ********************************************************************************

    結論:

    比較兩次拋出的ERROR,不難發現這句話“

    Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}"

    ”,真相大白:mule通過<inbound></inbound>中得到的結果,作為尋找方法中參數的依據,由于該項目中,從終端輸入的內容,項目接收時為String類型,因此,mule將查找參數類型為String的方法,同時,mule將拋棄所有符合“getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll”的方法,如果符合條件的只有一個,那正好調用,否則,就拋出ERROR。

    如果程序中很可以確定是哪個方法,大可讓他自己去找,成人之美,若是不能確定是哪個方法,那么就只能夠指腹為婚了,進行如下配置:

    將嘗試二的配置文件修改為:

    [java] view plaincopyprint?
  • <?xml version="1.0" encoding="UTF-8"?>?
  • <mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"?
  • ?????? xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?
  • ?????? xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2"?
  • ??? xsi:schemaLocation="?
  • ?????? http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd?
  • ?????? http://www.mulesource.org/schema/mule/stdio/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd">?
  • ??? <stdio:connector name="SystemStreamConnector"?????
  • ??????? promptMessage="Please enter yout name: " messageDelayTime="1000"/>??
  • ?????????
  • ??? <model name="HelloSample">???????
  • ??????? <service name="HelloUMO">?????
  • ??????????? <inbound>?????
  • ??????????????? <stdio:inbound-endpoint system="IN" />????
  • ??????????? </inbound>????????????????
  • ??????????? <component class="demo.mule.umo.impl.HelloWorldImpl">?
  • ??????????????? <method-entry-point-resolver>?
  • ??????????????????? <include-entry-point method="sayHello2"/>?
  • ??????????????? </method-entry-point-resolver>?
  • ??????????? </component>?????
  • ?????
  • ??????????? <outbound>?????
  • ??????????????? <pass-through-router>?????
  • ??????????????????? <stdio:outbound-endpoint system="OUT" />?????
  • ??????????????? </pass-through-router>?????
  • ??????????? </outbound>?????
  • ??????? </service>???????????
  • ??? </model>?
  • ?????
  • </mule>?
  • <?xml version="1.0" encoding="UTF-8"?> <mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2"xsi:schemaLocation="http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsdhttp://www.mulesource.org/schema/mule/stdio/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd"><stdio:connector name="SystemStreamConnector" promptMessage="Please enter yout name: " messageDelayTime="1000"/> <model name="HelloSample"> <service name="HelloUMO"> <inbound> <stdio:inbound-endpoint system="IN" /> </inbound> <component class="demo.mule.umo.impl.HelloWorldImpl"><method-entry-point-resolver><include-entry-point method="sayHello2"/></method-entry-point-resolver></component> <outbound> <pass-through-router> <stdio:outbound-endpoint system="OUT" /> </pass-through-router> </outbound> </service> </model></mule>

    設置方法切入點,運行,成功!

    總結

    以上是生活随笔為你收集整理的Mule学习笔记(二)的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。