1

I have a question about mule RMItransports

This is Example_RMITest.xml

<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" />   
<endpoint name="Sender2" address="rmi://192.168.0.4:1111/mytask?method=say"
    exchange-pattern="request-response"/>       
<flow name="TestUMO">
   <inbound-endpoint address="vm://query" exchange-pattern="request-response"/>
    <outbound-endpoint ref="Sender"/>
</flow>

This is my Cilent program:

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", null, null);         
              System.out.println("response = " + response.getPayload());  
          }  

}

The exception is:

There is no receiver registered on connector "connector.VM.mule.default" for endpointUri vm://query

1 Answer 1

3

This issue you're having has nothing to do with RMI: Mule can't find the vm://query endpoint because, by using:

MuleClient client = new MuleClient(true);

you are starting a second Mule, void of any configuration, hence in which the VM endpoint can't be found.

Instead use:

MuleClient client = muleContext.getClient();

to get a client connected to the running Mule.

2
  • I try it agian. But it still fail. please give me a mule RMI example.
    – lz5210
    Sep 9, 2013 at 2:54
  • If it still fails, it's for a different reason, ie you probably have now a different exception stack. Please accept this answer and open a new question with the new stack you're getting. Sep 9, 2013 at 4:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.