2 xll xz xll_xz 于 2013.08.20 17:29 提问

关于MULE调用RMI服务的问题

这是MULE的配置文件.
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:rmi="http://www.mulesoft.org/schema/mule/rmi"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/rmi http://www.mulesoft.org/schema/mule/rmi/current/mule-rmi.xsd">

<spring:bean id="jndiFactory" name="jndiFactory" class="org.mule.transport.rmi.MuleRMIFactory"/>

<spring:bean id="jndiContext" name="jndiContext" factory-bean="jndiFactory" factory-method="create">
    <spring:constructor-arg><spring:null /></spring:constructor-arg>
</spring:bean>

<rmi:connector name="rmi" jndiContext-ref="jndiContext" />

<vm:connector name="vmQueue"/>

<rmi:endpoint name="Sender" host="localhost" port="1099" object="SimpleMathsUMO" 
    method="addTen" exchange-pattern="request-response"/>

<endpoint name="Sender2" address="rmi://localhost:1099/MatchingUMO?method=reverseString"
    exchange-pattern="request-response"/>


<flow name="TestUMO">
    <inbound-endpoint address="vm://query" exchange-pattern="request-response"/>
    <outbound-endpoint ref="Sender"/>
</flow>

这是客户端的程序.

import java.util.HashMap;
import java.util.Map;

import org.mule.api.MuleContext;
import org.mule.api.MuleException;
import org.mule.api.MuleMessage;
import org.mule.context.DefaultMuleContextFactory;
import org.mule.module.client.MuleClient;

public class MyMuleClientTest {
public static void main(String[] args) throws MuleException

{

// create mule

MuleContext muleContext;

String config = "Example_RMITest.xml";

muleContext = new DefaultMuleContextFactory().createMuleContext(config);

muleContext.start();

// creat mule client

MuleClient client = new MuleClient(true);

Map map = new HashMap();

// map.put("firstName", "p001");

MuleMessage response = client.send("vm://query", map, null);

System.out.println("response = " + response.getPayload());

}

}

现在我遇到了这个异常:"There is no receiver registered on connector "connector.VM.mule.default" for endpointUri vm://query".
我真的不知道为什么了,请帮帮我,谢谢!

Csdn user default icon
上传中...
上传图片
插入图片