大鸡腿 2013-08-20 09:29 采纳率: 0%
浏览 1369

关于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".
我真的不知道为什么了,请帮帮我,谢谢!

  • 写回答

1条回答

  • ChatGPTᴼᴾᴱᴺᴬᴵ 2023-01-13 09:26
    关注

    这个错误是由于客户端在发送请求时使用了 vm://query 这个 endpoint URI,但是在配置文件中并没有使用这个 endpoint URI 的 inbound-endpoint。


    在配置文件中,你定义了一个名为 "TestUMO" 的流,并在其中定义了 inbound-endpoint address 为 "vm://query" 的 inbound-endpoint,但是在客户端中并没有使用这个 inbound-endpoint。而是使用了 "vm://query" endpoint URI 发送请求。


    你需要在客户端中使用 inbound-endpoint address 发送请求,而不是使用 endpoint URI。例如:

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

    应该改为:

    MuleMessage response = client.send("TestUMO.in", map, null);
    

    另外,你还需要确保在配置文件中已经启动了 vm connector,可以在配置文件中找到这行代码:

    <vm:connector name="vmQueue"/>
    

    如果没有这行,就需要添加。

    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?