大鸡腿 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"/>
    

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

    评论

报告相同问题?

悬赏问题

  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容