You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by bhuvi <bh...@allfon.com> on 2006/09/29 06:28:33 UTC

problem in dispatching message to destination service(JMS)

hi all,

i tried the jms component that would route the message to my receiver
component.i wrote my owm xml .The broker is initiated properly.my jms
component is receiving yhe message.but the problem is with dispatching the
message to the specified destination service. i get the following exception.

my onMessage() method has the following lines of code.
i think the problem is with setting the destination. could anyone suggest me
a solution.
public void onMessage(Message jmsMessage) {
        if (log.isTraceEnabled()) {
            log.trace("Received: " + jmsMessage);
            
        }

        try {
        	ComponentContext ctx= getContext();
         InOnly messageExchange =
ctx.getDeliveryChannel().createExchangeFactory().createInOnlyExchange();
         NormalizedMessage inMessage = messageExchange.createMessage();
         SourceTransformer st= new SourceTransformer();
            try {
                marshaler.toNMS(inMessage, jmsMessage);   
                String test=null;
	try {
		test = st.toString(inMessage.getContent());
		} catch (TransformerException e1) {
		// TODO Auto-generated catch block
		e1.printStackTrace();
		}
					
                //added now
                resolver = new ServiceNameEndpointResolver( new
QName("http://servicemix.org/example/", "receiver"));
                ServiceEndpoint destination = null;
                
                System.out.println("Assigned Resolver:"+resolver);  
                if (resolver != null)
                {    ComponentContext compctx = getContext();
                	 System.out.println("resolver----++>"+resolver);  
                     destination =
resolver.resolveEndpoint(getContext(),messageExchange,
NullEndpointFilter.getInstance());                    
System.out.println("resolver----++>"+resolver);  
                }
                if (destination != null)
                {
                   // lets explicitly specify the destination - otherwise
                   // we'll let the container choose for us
                    System.out.println("Assigned Destination:"+destination);
                    ///String temp
=sourceTransformer.toString(inMessage.getContent());
                    messageExchange.setEndpoint(destination);
                }
           
                messageExchange.setInMessage(inMessage);
              
                inMessage.setContent(new StringSource(test));          
                ctx.getDeliveryChannel().send(messageExchange);           
                //end 
            }
            catch (JMSException e) {
                messageExchange.setError(e);
                messageExchange.setStatus(ExchangeStatus.ERROR);
            }
        }
        catch (JBIException e) {
            throw new RuntimeJBIException(e);
        }
    }


09:46:30,844 ERROR [ActiveMQSession] error dispatching message: 
org.apache.servicemix.jbi.RuntimeJBIException:
org.apache.servicemix.jbi.NoServiceAvailableException: Cannot find an
instance of the service: {http://servicemix.org/example/}receiver
	at
src.com.jeffhanson.esb.servicemix.JmsInBinding.onMessage(JmsInBinding.java:122)
	at
org.jencks.LocalTransactionEndpoint.onMessage(LocalTransactionEndpoint.java:68)
	at
org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:120)
	at
org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:60)
	at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:692)
	at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:163)
	at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
	at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown
Source)
	at java.lang.Thread.run(Thread.java:595)
Caused by: org.apache.servicemix.jbi.NoServiceAvailableException: Cannot
find an instance of the service: {http://servicemix.org/example/}receiver
	at
org.apache.servicemix.jbi.resolver.ServiceNameEndpointResolver.createServiceUnavailableException(ServiceNameEndpointResolver.java:60)
	at
org.apache.servicemix.jbi.resolver.EndpointResolverSupport.resolveEndpoint(EndpointResolverSupport.java:39)
	at
src.com.jeffhanson.esb.servicemix.JmsInBinding.onMessage(JmsInBinding.java:98)
	... 8 more

-- 
View this message in context: http://www.nabble.com/problem-in-dispatching-message-to-destination-service%28JMS%29-tf2354983.html#a6559245
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: problem in dispatching message to destination service(JMS)

Posted by Guillaume Nodet <gn...@gmail.com>.
As the error indicates, the destination service has been set
correctly.  The problem is that the
{http://servicemix.org/example/}receiver
service has not been activated.  You need a component
which activate a JBI endpoint with this service name in order
to receive the exchanges.

On 9/29/06, bhuvi <bh...@allfon.com> wrote:
>
> hi all,
>
> i tried the jms component that would route the message to my receiver
> component.i wrote my owm xml .The broker is initiated properly.my jms
> component is receiving yhe message.but the problem is with dispatching the
> message to the specified destination service. i get the following exception.
>
> my onMessage() method has the following lines of code.
> i think the problem is with setting the destination. could anyone suggest me
> a solution.
> public void onMessage(Message jmsMessage) {
>         if (log.isTraceEnabled()) {
>             log.trace("Received: " + jmsMessage);
>
>         }
>
>         try {
>                 ComponentContext ctx= getContext();
>          InOnly messageExchange =
> ctx.getDeliveryChannel().createExchangeFactory().createInOnlyExchange();
>          NormalizedMessage inMessage = messageExchange.createMessage();
>          SourceTransformer st= new SourceTransformer();
>             try {
>                 marshaler.toNMS(inMessage, jmsMessage);
>                 String test=null;
>         try {
>                 test = st.toString(inMessage.getContent());
>                 } catch (TransformerException e1) {
>                 // TODO Auto-generated catch block
>                 e1.printStackTrace();
>                 }
>
>                 //added now
>                 resolver = new ServiceNameEndpointResolver( new
> QName("http://servicemix.org/example/", "receiver"));
>                 ServiceEndpoint destination = null;
>
>                 System.out.println("Assigned Resolver:"+resolver);
>                 if (resolver != null)
>                 {    ComponentContext compctx = getContext();
>                          System.out.println("resolver----++>"+resolver);
>                      destination =
> resolver.resolveEndpoint(getContext(),messageExchange,
> NullEndpointFilter.getInstance());
> System.out.println("resolver----++>"+resolver);
>                 }
>                 if (destination != null)
>                 {
>                    // lets explicitly specify the destination - otherwise
>                    // we'll let the container choose for us
>                     System.out.println("Assigned Destination:"+destination);
>                     ///String temp
> =sourceTransformer.toString(inMessage.getContent());
>                     messageExchange.setEndpoint(destination);
>                 }
>
>                 messageExchange.setInMessage(inMessage);
>
>                 inMessage.setContent(new StringSource(test));
>                 ctx.getDeliveryChannel().send(messageExchange);
>                 //end
>             }
>             catch (JMSException e) {
>                 messageExchange.setError(e);
>                 messageExchange.setStatus(ExchangeStatus.ERROR);
>             }
>         }
>         catch (JBIException e) {
>             throw new RuntimeJBIException(e);
>         }
>     }
>
>
> 09:46:30,844 ERROR [ActiveMQSession] error dispatching message:
> org.apache.servicemix.jbi.RuntimeJBIException:
> org.apache.servicemix.jbi.NoServiceAvailableException: Cannot find an
> instance of the service: {http://servicemix.org/example/}receiver
>         at
> src.com.jeffhanson.esb.servicemix.JmsInBinding.onMessage(JmsInBinding.java:122)
>         at
> org.jencks.LocalTransactionEndpoint.onMessage(LocalTransactionEndpoint.java:68)
>         at
> org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:120)
>         at
> org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:60)
>         at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:692)
>         at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:163)
>         at
> org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
>         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown
> Source)
>         at java.lang.Thread.run(Thread.java:595)
> Caused by: org.apache.servicemix.jbi.NoServiceAvailableException: Cannot
> find an instance of the service: {http://servicemix.org/example/}receiver
>         at
> org.apache.servicemix.jbi.resolver.ServiceNameEndpointResolver.createServiceUnavailableException(ServiceNameEndpointResolver.java:60)
>         at
> org.apache.servicemix.jbi.resolver.EndpointResolverSupport.resolveEndpoint(EndpointResolverSupport.java:39)
>         at
> src.com.jeffhanson.esb.servicemix.JmsInBinding.onMessage(JmsInBinding.java:98)
>         ... 8 more
>
> --
> View this message in context: http://www.nabble.com/problem-in-dispatching-message-to-destination-service%28JMS%29-tf2354983.html#a6559245
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet