camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From takidean <takide...@hotmail.fr>
Subject what's wrong with mina endpoint
Date Thu, 02 May 2013 09:44:01 GMT
Hi
i have to send from a web service an id to a socket server .
when i get the id in my exchange then i use to send it 

        <to uri="mina:tcp://localhost:13266?textline=true&amp;sync=false"/>
i get this error

[                qtp21158020-25] WebApplicationExceptionMapper  WARN 
javax.ws.rs.WebApplicationException:
org.apache.camel.CamelExchangeException: Cannot write body.
Exchange[Message: insertinsert111]

my code is here
/********route****/
 <route>
        
        <from uri="cxfrs://bean://solde"/>
        <convertBodyTo type="java.lang.String"/>
        <process ref="conv"/>
        <to uri="mina:tcp://localhost:13266?textline=true&amp;sync=false"/>
        <delay>
            <description>&lt;bean ref="Provider"/&gt;</description>
            <constant>3000</constant>
        </delay>
        <bean ref="test"/>
    </route>

/**********socket server***********/
public class ServerFile {
     public static void main (String [] args ) throws Exception {
    // create socket
    ServerSocket servsock = new ServerSocket(13266);
    while (true) {
      System.out.println("Waiting...");

      Socket sock = servsock.accept();
      System.out.println("Accepted connection : " + sock);
      OutputStream os = sock.getOutputStream();
    new ServerFile().send(os);
      sock.close();
      }
    }

  public void send(OutputStream os) throws Exception{
      // sendfile
      File myFile = new File ("C:\\taki\\taki.txt");
      byte [] mybytearray  = new byte [(int)myFile.length()+1];
      FileInputStream fis = new FileInputStream(myFile);
      BufferedInputStream bis = new BufferedInputStream(fis);
      bis.read(mybytearray,0,mybytearray.length);
      System.out.println("Sending...");
      os.write(mybytearray,0,mybytearray.length);
      os.flush();
  }
    
}

/*********



--
View this message in context: http://camel.465427.n5.nabble.com/what-s-wrong-with-mina-endpoint-tp5731901.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message