Mule学习笔记(二)

简介: Mule的第一个应用非常简单。却也可以看出Mule的运行机制。上例中,实现的是Hello world 的例子,过程为:用户输入内容,回车,然后显示Hello,[输入的内容]。这个实现非常简单,但是,却也存在一些问题,mule是怎么知道显示这些内容的,现在就研究这个。 也许大家觉得,在XXXX.xml中已经配置了类路径,mule当然可以找到这个类,问题就在这里,mule找到了实现类,那

Mule的第一个应用非常简单。却也可以看出Mule的运行机制。上例中,实现的是Hello world 的例子,过程为:用户输入内容,回车,然后显示Hello,[输入的内容]。这个实现非常简单,但是,却也存在一些问题,mule是怎么知道显示这些内容的,现在就研究这个。

也许大家觉得,在XXXX.xml中已经配置了类路径,mule当然可以找到这个类,问题就在这里,mule找到了实现类,那他是如何找到对应的方法的呢?OK,做一下尝试

1、尝试一

将inteface修改为:

  1. package demo.mule.umo; 
  2.  
  3. public interface HelloWorld { 
  4.     public String sayHello(String str); 
  5.     public String sayHello(); 
package demo.mule.umo; public interface HelloWorld { public String sayHello(String str); public String sayHello(); }

实现类修改为:

  1. package demo.mule.umo.impl; 
  2. import demo.mule.umo.HelloWorld; 
  3. public class HelloWorldImpl implements HelloWorld { 
  4.     @Override 
  5.     public String sayHello(String str) { 
  6.         return "Hello," + str; 
  7.     } 
  8.     @Override 
  9.     public String sayHello() { 
  10.         return "Hello world"
  11.     } 
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"; } }

运行项目:运行成功!

2、尝试二

修改interface为:

  1. package demo.mule.umo; 
  2.  
  3. public interface HelloWorld { 
  4.     public String sayHello(String str); 
  5.     public String sayHello2(String str); 
package demo.mule.umo; public interface HelloWorld { public String sayHello(String str); public String sayHello2(String str); }

修改实现类为:

  1. package demo.mule.umo.impl; 
  2. import demo.mule.umo.HelloWorld; 
  3. public class HelloWorldImpl implements HelloWorld { 
  4.     @Override 
  5.     public String sayHello(String str) { 
  6.         return "Hello," + str; 
  7.     } 
  8.     @Override 
  9.     public String sayHello2(String str) { 
  10.         return "Hello2 ," + str; 
  11.     } 
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; } }

运行:抛出ERROR

  1. ERROR 2011-02-09 17:04:41,874 [HelloUMO.2] org.mule.service.DefaultServiceExceptionStrategy:  
  2. ******************************************************************************** 
  3. Message               : [ 
  4. The required property "method" is not set on the event 
  5. CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@12f1bf0" does not implement required interface "interface org.mule.api.lifecycle.Callable" 
  6. 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}" 
  7. 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}" 
  8. Type                  : org.mule.model.resolvers.EntryPointNotFoundException 
  9. Code                  : MULE_ERROR--2 
  10. JavaDoc               : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html 
  11. ******************************************************************************** 
  12. Exception stack is: 
  13. 1. [ 
  14. The required property "method" is not set on the event 
  15. CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@12f1bf0" does not implement required interface "interface org.mule.api.lifecycle.Callable" 
  16. 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}" 
  17. 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}" 
  18. ] (org.mule.model.resolvers.EntryPointNotFoundException) 
  19.   org.mule.model.resolvers.DefaultEntryPointResolverSet:63 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html) 
  20. ******************************************************************************** 
  21. Root Exception stack trace: 
  22. org.mule.model.resolvers.EntryPointNotFoundException: [ 
  23. The required property "method" is not set on the event 
  24. CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@12f1bf0" does not implement required interface "interface org.mule.api.lifecycle.Callable" 
  25. 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}" 
  26. 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}" 
  27.     at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:63
  28.     at org.mule.component.DefaultLifecycleAdapter.invoke(DefaultLifecycleAdapter.java:205
  29.     at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:83
  30.     at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:74
  31.     at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:133
  32.     at org.mule.component.AbstractComponent.invoke(AbstractComponent.java:161
  33.     at org.mule.service.AbstractService.invokeComponent(AbstractService.java:929
  34.     at org.mule.model.seda.SedaService.access$100(SedaService.java:56
  35.     at org.mule.model.seda.SedaService$ComponentStageWorker.run(SedaService.java:574
  36.     at org.mule.work.WorkerContext.run(WorkerContext.java:310
  37.     at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061
  38.     at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575
  39.     at java.lang.Thread.run(Thread.java:619
  40. ******************************************************************************** 
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:

  1. package demo.mule.umo; 
  2.  
  3. public interface HelloWorld { 
  4.     public String sayHello(); 
  5.     public String sayHello2(); 
package demo.mule.umo; public interface HelloWorld { public String sayHello(); public String sayHello2(); }

修改实现类:

  1. package demo.mule.umo.impl; 
  2. import demo.mule.umo.HelloWorld; 
  3. public class HelloWorldImpl implements HelloWorld { 
  4.     @Override 
  5.     public String sayHello() { 
  6.         return "Hello world"
  7.     } 
  8.     @Override 
  9.     public String sayHello2() { 
  10.         return "Hello2 world"
  11.     } 
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"; } }

运行:抛出ERROR

  1. ERROR 2011-02-09 17:07:27,811 [HelloUMO.2] org.mule.service.DefaultServiceExceptionStrategy:  
  2. ******************************************************************************** 
  3. Message               : [ 
  4. The required property "method" is not set on the event 
  5. CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@1f02b85" does not implement required interface "interface org.mule.api.lifecycle.Callable" 
  6. 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}" 
  7. 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}" 
  8. Type                  : org.mule.model.resolvers.EntryPointNotFoundException 
  9. Code                  : MULE_ERROR--2 
  10. JavaDoc               : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html 
  11. ******************************************************************************** 
  12. Exception stack is: 
  13. 1. [ 
  14. The required property "method" is not set on the event 
  15. CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@1f02b85" does not implement required interface "interface org.mule.api.lifecycle.Callable" 
  16. 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}" 
  17. 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}" 
  18. ] (org.mule.model.resolvers.EntryPointNotFoundException) 
  19.   org.mule.model.resolvers.DefaultEntryPointResolverSet:63 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html) 
  20. ******************************************************************************** 
  21. Root Exception stack trace: 
  22. org.mule.model.resolvers.EntryPointNotFoundException: [ 
  23. The required property "method" is not set on the event 
  24. CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@1f02b85" does not implement required interface "interface org.mule.api.lifecycle.Callable" 
  25. 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}" 
  26. 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}" 
  27.     at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:63
  28.     at org.mule.component.DefaultLifecycleAdapter.invoke(DefaultLifecycleAdapter.java:205
  29.     at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:83
  30.     at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:74
  31.     at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:133
  32.     at org.mule.component.AbstractComponent.invoke(AbstractComponent.java:161
  33.     at org.mule.service.AbstractService.invokeComponent(AbstractService.java:929
  34.     at org.mule.model.seda.SedaService.access$100(SedaService.java:56
  35.     at org.mule.model.seda.SedaService$ComponentStageWorker.run(SedaService.java:574
  36.     at org.mule.work.WorkerContext.run(WorkerContext.java:310
  37.     at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061
  38.     at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575
  39.     at java.lang.Thread.run(Thread.java:619
  40. ******************************************************************************** 
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。

如果程序中很可以确定是哪个方法,大可让他自己去找,成人之美,若是不能确定是哪个方法,那么就只能够指腹为婚了,进行如下配置:

将尝试二的配置文件修改为:

  1. <?xml version="1.0" encoding="UTF-8"?> 
  2. <mule xmlns="http://www.mulesource.org/schema/mule/core/2.2" 
  3.        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  4.        xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2" 
  5.     xsi:schemaLocation=" 
  6.        http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd 
  7.        http://www.mulesource.org/schema/mule/stdio/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd"> 
  8.     <stdio:connector name="SystemStreamConnector"     
  9.         promptMessage="Please enter yout name: " messageDelayTime="1000"/>  
  10.          
  11.     <model name="HelloSample">       
  12.         <service name="HelloUMO">     
  13.             <inbound>     
  14.                 <stdio:inbound-endpoint system="IN" />    
  15.             </inbound>                
  16.             <component class="demo.mule.umo.impl.HelloWorldImpl"
  17.                 <method-entry-point-resolver> 
  18.                     <include-entry-point method="sayHello2"/> 
  19.                 </method-entry-point-resolver> 
  20.             </component>     
  21.      
  22.             <outbound>     
  23.                 <pass-through-router>     
  24.                     <stdio:outbound-endpoint system="OUT" />     
  25.                 </pass-through-router>     
  26.             </outbound>     
  27.         </service>           
  28.     </model> 
  29.      
  30. </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.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>

设置方法切入点,运行,成功!

目录
相关文章
|
4月前
|
JavaScript
使用TS的一些基础知识
使用TS的一些基础知识
23 0
|
JavaScript
TS学习(二):进阶使用
TS学习(二):进阶使用
TS学习(二):进阶使用
|
存储 Java 关系型数据库
JPA1|学习笔记
快速学习JPA1
114 0
JPA1|学习笔记
|
存储 前端开发 Java
JPA 6|学习笔记
快速学习JPA 6
128 0
JPA 6|学习笔记
|
存储 SQL 前端开发
JPA3|学习笔记
快速学习JPA3
127 0
JPA3|学习笔记
|
存储 JSON 前端开发
JPA 8|学习笔记
快速学习JPA 8
132 0
JPA 8|学习笔记
|
SQL 前端开发 Java
JPA2|学习笔记
快速学习JPA2
79 0
JPA2|学习笔记
|
存储 前端开发 JavaScript
JPA 7|学习笔记
快速学习 JPA 7
93 0
 JPA 7|学习笔记
|
存储 前端开发 NoSQL
JPA 5|学习笔记
快速学习JPA 5
111 0
JPA 5|学习笔记
|
存储 自然语言处理 开发者
WhitespaceAnalyzer|学习笔记
快速学习 WhitespaceAnalyzer
63 0
WhitespaceAnalyzer|学习笔记

热门文章

最新文章