[mule-user] org.mule.api.transport.NoReceiverForEndpointException: vm0

已查看 12 次
跳至第一个未读帖子

Fang Digou

未读,
2010年1月18日 08:45:332010/1/18
收件人 us...@mule.codehaus.org
This example realized this function ,when you input a Integer 5,first the Square.java can change the 5 to 25,then using the Inverse.java,the output answer will be -25,but
it always reported some errors.

the configuration file:
<service name="Square">
<inbound>
<vm:inbound-endpoint path="math" />
</inbound>
<component class="shou.mule.Square"/>
<outbound>
<pass-through-router>
<vm:outbound-endpoint path="inverse" />
</pass-through-router>
</outbound>
</service>

<service name="Inverse">
<inbound>
<vm:inbound-endpoint path="inverse" />
</inbound>
<component class="shou.mule.Inverse"/>
</service>

the test client :MuleClient1.java

package shou.mule;

import org.mule.api.MuleException;
import org.mule.api.MuleMessage;
import org.mule.module.client.MuleClient;

public class ClientTest1 {
public static void main(String[] args){
MuleClient client = null;
try {
client = new MuleClient();
String url = "vm://math";

MuleMessage message = client.send(url,5,null);
Integer obj = (Integer) message.getPayload();
System.out.println(obj.intValue());

} catch (MuleException e) {
e.printStackTrace();
}finally{
client.dispose();
}

}
}


the two java component :
Square.java:
package shou.mule;

public class Square {
private int payload=0;
public int square(int num) {
payload=num*num;
return payload;
}
}


Inverse.java:
package shou.mule;

public class Inverse {
private int iresult=0;
public int inverse(int num) {
iresult=num*(-1);
return iresult;
}
}
when i tested this example,it always reported this errors:

org.mule.api.transport.DispatchException: Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=vm://math, connector=VMConnector{this=12a3793, started=true, initialised=true, name='connector.VM.0', disposed=false, numberOfConcurrentTransactedReceivers=4, createMultipleTransactedReceivers=true, connected=true, supportedProtocols=[vm], serviceOverrides=null}, transformer=[], name='endpoint.vm.math', properties={}, transactionConfig=Transaction{factory=null, action=NEVER, timeout=0}, filter=null, deleteUnacceptedMessages=false, securityFilter=null, synchronous=false, initialState=started, remoteSync=false, remoteSyncTimeout=10000, endpointEncoding=UTF-8}. Message payload is of type: Integer
at org.mule.transport.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:195)
at org.mule.transport.AbstractConnector.send(AbstractConnector.java:1929)
at org.mule.endpoint.DefaultOutboundEndpoint.send(DefaultOutboundEndpoint.java:77)
at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:327)
at org.mule.module.client.MuleClient.send(MuleClient.java:650)
at org.mule.module.client.MuleClient.send(MuleClient.java:627)
at org.mule.module.client.MuleClient.send(MuleClient.java:580)
at shou.mule.ClientTest1.main(ClientTest1.java:14)
Caused by: org.mule.api.transport.NoReceiverForEndpointException: There is no receiver registered on connector "connector.VM.0" for endpointUri vm://math
at org.mule.transport.vm.VMMessageDispatcher.doSend(VMMessageDispatcher.java:109)
at org.mule.transport.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:168)
... 7 more


would you give me some answers,thank you again.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Dirk Olmes

未读,
2010年1月18日 08:55:562010/1/18
收件人 us...@mule.codehaus.org
Fang Digou wrote:
> This example realized this function ,when you input a Integer 5,first the Square.java can change the 5 to 25,then using the Inverse.java,the output answer will be -25,but
> it always reported some errors.
>
> the configuration file:
> <service name="Square">
> <inbound>
> <vm:inbound-endpoint path="math" />
> </inbound>
> <component class="shou.mule.Square"/>
> <outbound>
> <pass-through-router>
> <vm:outbound-endpoint path="inverse" />
> </pass-through-router>
> </outbound>
> </service>
>
> <service name="Inverse">
> <inbound>
> <vm:inbound-endpoint path="inverse" />
> </inbound>
> <component class="shou.mule.Inverse"/>
> </service>

you're using async endpoints, I'm not sure if that's what you want. Try
making all endpoints sync.

-dirk

Fang Digou

未读,
2010年1月18日 21:01:122010/1/18
收件人 us...@mule.codehaus.org
Thank you for Dirk,under your suggestion, I added synchronous="true" to each vm,but it also reported that errors,I really don"t know why?

maybe there is something wrong with the the java component Square.java and Inverse.java.

David Dossot

未读,
2010年1月18日 21:44:162010/1/18
收件人 us...@mule.codehaus.org
I don't see where you're loading your Mule config: it seems you're running against an empty Mule instance.

Try:  client = new MuleClient("your-mule-config.xml");

Also: why making your components statefull?

D.

Fang Digou

未读,
2010年1月19日 02:23:312010/1/19
收件人 us...@mule.codehaus.org
Hello,David
First,thank you for your answers,your suggestion is very good .
when i tried " client = new MuleClient("your-mule-config.xml");" it did wonders,
all error gone away.
i don"t understand the meaning of " why making your components statefull?"
*can you give me an example.*

else :it also reported errors:
2010-1-19 15:09:59 org.apache.cxf.bus.spring.BusApplicationContext getConfigResources
&#20449;&#24687;: No cxf.xml configuration file detected, relying on defaults.
Exception in thread "main" java.lang.ClassCastException: org.mule.transport.NullPayload cannot be cast to java.lang.Integer
at shou.mule.ClientTest1.main(ClientTest1.java:15)


thank you again.

-Fang

Dirk Olmes

未读,
2010年1月19日 08:01:042010/1/19
收件人 us...@mule.codehaus.org
Fang Digou wrote:
> Hello,David
> First,thank you for your answers,your suggestion is very good .
> when i tried " client = new MuleClient("your-mule-config.xml");" it did wonders,
> all error gone away.

I'm glad it helped :-)

> i don"t understand the meaning of " why making your components statefull?"
> *can you give me an example.*

Have a look at one of your classes:

public class Square {
private int payload=0;

public int square(int num) {
payload=num*num;
return payload;
}
}

it has an instance variable "payload" that holds the result of the
computation. Why would you hold on to that state? The square() method
should just return the result of the calculation.

-dirk

David Dossot

未读,
2010年1月19日 13:28:082010/1/19
收件人 us...@mule.codehaus.org
Exception in thread "main" java.lang.ClassCastException: org.mule.transport.NullPayload cannot be cast to java.lang.Integer
       at shou.mule.ClientTest1.main(ClientTest1.java:15)

Are you sure you've made the "vm://math" inbound endpoint synchronous?

D.

Fang Digou

未读,
2010年1月23日 01:09:522010/1/23
收件人 us...@mule.codehaus.org
yes i'm sure.maybe there exist any other problems.

David Dossot

未读,
2010年1月23日 11:31:552010/1/23
收件人 us...@mule.codehaus.org
is your component called when you get this null response?

d.
回复全部
回复作者
转发
0 个新帖子