Hi Mar, Kheng Kok

I experienced with a similar  problem also when using http.
The problem is you are using httpConnector that extends HttpInOutBinding
Take a look at the code HttpInOutBinding processInOut method and see
that :

            boolean result = getDeliveryChannel().sendSync(exchange);
            if (result) {
                getMarshaler().toResponse(exchange,
exchange.getOutMessage(), response);
            }
            done(exchange);
            response.setStatus(HttpServletResponse.SC_OK);
Because its inout due to the JBI spec the consumer (HttpConnector must
call done( ) and not provider can't call done )

I think u should change your code from:

public class MySender extends   PojoSupport  implements
MessageExchangeListener  {

       public void onMessageExchange(MessageExchange exchange) throws
MessagingException {

           NormalizedMessage message = exchange.createMessage();
           message.setContent(new StringSource(getQuote("quote.txt",
                                     "<quote>3.0</quote>")));
           done(exchange);

      }  .............

To: 

public class MySender extends   PojoSupport  implements
MessageExchangeListener  {

       public void onMessageExchange(MessageExchange exchange) throws
MessagingException {

           NormalizedMessage message = exchange.createMessage();
           message.setContent(new StringSource(getQuote("quote.txt",
                                     "<quote>3.0</quote>")));
++++++++++++++++++++++++++++++++
        //calling send instead of done
           send(exchange);
++++++++++++++++++++++++++++++++

      }  .............

Regards
Yitzhaki Yitzhak

-----Original Message-----
From: Mar, Kheng Kok [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 08, 2005 11:48 AM
To: [email protected]
Subject: [servicemix-user] Illegal exchange status 

Hi all. I've just started to use servicemix. I am trying a simple
example of setting up a HttpServer (using the HttpConnector component)
that listens on a specific port which in turn invokes the POJO that
component that returns a text message reply.  I encountered a illegal
exchange status error as shown in the stack trace below, when the code
call done() helper function of Pojo.  I have attached my configuration
and MySender.java  at the end of the mail. Can anyone shed any light on
what can be the cause of this error ? 

 ________Stack Trace _________ 

javax.jbi.messaging.MessagingException: illegal exchange status: done
        at
org.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(MessageExcha
ngeImpl.java:535)
        at
org.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelI
mpl.java:346)
        at
org.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImp
l.java:387)
        at
org.servicemix.components.util.PojoSupport.done(PojoSupport.java:209)
        at MySender.onMessageExchange(Unknown Source)
        at
org.servicemix.components.util.ComponentAdaptorMEListener.onMessageExcha
nge(ComponentAdaptorMEListener.java:48)
        at
org.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(Delivery
ChannelImpl.java:588)
        at
org.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171
)
        at
org.servicemix.jbi.nmr.flow.seda.SedaFlow.doSend(SedaFlow.java:140)
        at
org.servicemix.jbi.nmr.flow.AbstractFlow.send(AbstractFlow.java:119)
        at
org.servicemix.jbi.nmr.Broker.sendExchangePacket(Broker.java:289)
        at
org.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java
:567)
        at
org.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelI
mpl.java:347)
        at
org.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChanne
lImpl.java:422)
        at
org.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChanne
lImpl.java:398)
        at
org.servicemix.components.http.HttpInOutBinding.processInOut(HttpInOutBi
nding.java:61)
        at
org.servicemix.components.http.HttpInOutBinding.process(HttpInOutBinding
        at
org.servicemix.components.http.BindingServlet.doGet(BindingServlet.java:
68)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
        at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:354)
        at
org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:65
7)
        at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1807)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1757)
        at org.mortbay.http.HttpServer.service(HttpServer.java:879)
        at
org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
        at
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:961)
        at
org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
        at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:197
)
        at
org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:276)
        at
org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:511)

___ servicemix.xml ______________
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xbean.org/schemas/spring/1.0";
        xmlns:spring="http://xbean.org/schemas/spring/1.0";
        xmlns:sm="http://servicemix.org/config/1.0";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://xbean.org/schemas/spring/1.0
                            http://servicemix.org/config/1.0
        xmlns:my="http://servicemix.org/demo/";>


        <!-- the JBI container -->
        <sm:container spring:id="jbi" useMBeanServer="true"
                createMBeanServer="true"
monitorInstallationDirectory="true" dumpStats="true"
                statsInterval="10">

                <sm:activationSpecs>
                        <sm:activationSpec componentName="httpReceiver"
service="my:httpBinding" endpoint="httpReceiver" destinationService=
"my:Sender">
                                <sm:component>
                                       <bean
xmlns="http://xbean.org/schemas/spring/1.0";
 
class="org.servicemix.components.http.HttpConnector">
                                          <property name="host"
value="localhost"/>
                                          <property name="port"
value="8089"/>
                                       </bean>
                                </sm:component>
                        </sm:activationSpec>

            <sm:activationSpec componentName="sender"
service="my:Sender">
               <sm:component>
               <spring:bean class="MySender"/>
               </sm:component>
            </sm:activationSpec>

                </sm:activationSpecs>
        </sm:container>

</beans>

-- MySender.java ---

public class MySender extends   PojoSupport  implements
MessageExchangeListener  {

       public void onMessageExchange(MessageExchange exchange) throws
MessagingException {

           NormalizedMessage message = exchange.createMessage();
           message.setContent(new StringSource(getQuote("quote.txt",
                                     "<quote>3.0</quote>")));
           done(exchange);

      }  .............

 

Best Regards
Kheng Kok



______________________________________________________________________
  This email message has been scanned by PineApp Mail-Secure and has
been found clean.


Reply via email to