Socket Channel Connection - Continuous read

Hi all,
I am new to socket programming. This is where I am stuck...I need to read from a channel 'continuously', i.e messages are continuous published and I need to keep on reading it. Below is my code for review....I am just getting the 1st line of the message. please suggest..Thanks in advance
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.util.Iterator;
import java.util.Set;
public class TestConnection {
     private static Charset charset = Charset.forName("ISO-8859-1");
     private static CharsetDecoder decoder = charset.newDecoder();
     public static void main(String[] args) throws IOException {
          SocketChannel sc = null;
          String desthost = "172.19.67.33";
          int port = 5002;
          InetSocketAddress isa = new InetSocketAddress(InetAddress.getByName(desthost), port);
          try {
               sc = SocketChannel.open();
               sc.connect(isa);
               System.out.println(" Message--> " + readFromChannel(sc, 4096));
          } catch (Exception e) {
               e.printStackTrace();
          } finally {
               if (sc != null)
                    sc.close();
     public static String readFromChannel(SocketChannel sChannel, final int size) throws IOException {
          int numBytes = 0;
          boolean hasRead = false;
          ByteBuffer inBuffer = ByteBuffer.allocateDirect(size);
          CharBuffer charBuffer = CharBuffer.allocate(size + 100);
          StringBuffer dataRead = new StringBuffer();
          Selector selector = Selector.open();
          System.out.println(" Is Connected--> " + sChannel.isConnected());
          System.out.println(" sChannel.isBlocking()--> " + sChannel.isBlocking());
          sChannel.configureBlocking(false);
          System.out.println(" sChannel.isBlocking()--> " + sChannel.isBlocking());
          sChannel.register(selector, SelectionKey.OP_READ);
          try {
               while (selector.select(20000) > 0) {
                    Set readyKeys = selector.selectedKeys();
                    Iterator readyItor = readyKeys.iterator();
                    while (readyItor.hasNext()) {
                         SelectionKey key = (SelectionKey) readyItor.next();
                         readyItor.remove();
                         ReadableByteChannel keyChannel = (SocketChannel) key.channel();
                         if (key.isReadable()) {
                              for (int i = 0;; i++) {
                                   int count = 0;
                                   if ((count = keyChannel.read(inBuffer)) < 0) // EOF
                                        keyChannel.close();
                                        throw new IOException("Socket lost connection during read operation");
                                   numBytes += count;
                                   if (!inBuffer.hasRemaining()) {
                                        hasRead = true;
                                        System.out.println("has read");
                                        System.out.println("SUCCESSFUL, length of data read:" + numBytes);
                                        inBuffer.flip();
                                        decoder.decode(inBuffer, charBuffer, false);
                                        charBuffer.flip();
                                        selector.close();
                                        return dataRead.append(charBuffer).toString();
                                   if (i >= 2) {
                                        break;
               if (false == hasRead) {
                    System.err.println("has _NOT_ read");
                    System.err.println("length of data read: " + numBytes);
                    System.err.println("length of data read: " + numBytes);
                    if (numBytes > 0) {
                         inBuffer.flip();
                         decoder.decode(inBuffer, charBuffer, false);
                         charBuffer.flip();
                         System.err.println("ERROR, data read: " + dataRead.append(charBuffer).toString());
                    throw new IOException("Socket read operation timed out");
               } else {
                    throw new IOException("Invalid Read Socket state");
          } finally {
               selector.close();
}

The output is -->
Is Connected--> true
sChannel.isBlocking()--> true
sChannel.isBlocking()--> false
has read
SUCCESSFUL, length of data read:4096
Message--> 000c100000300000007f100700302E12008071104060400 Lane Communication Is OK 004d100500300302E0100000027000000000000000000000000000010845800000000000000000000000c100000302E01007f100700303E12008071104140200 Lane Communication Is OK 004d100500300303E0402350427000000000000000000000000000119107300000008500000000000000c100000303E00007f100700304E12008070704085600 Lane Communication Is OK 004d100500300304E0201521427000000000000000000000000000081090700000003640000000000000c100000304E00007f100700305X12008071104111600 Lane Communication Is OK 004d100500300305X0801411215000000000000000000000000000048892600000000810000000001000c100000305X00007f100700306X12008071104102600 Lane Communication Is OK 004d100500300306X0800660815000000000000000000000000000046838800000000760000000000000c100000306X00007f100700307X12008063003542200 Lane Communication Is OK 004d100500300307X1000445315000000000000000000000000000125509000000017220000000127000c100000307X000104100300300307X200807111727309311015004453030200000000000000000000000000000527000001020102000000001154210344501304E2008071116072500EZPASS TAG# 022 - 04522780 STATUS = VALID TYPE = INTERIOR FPT Program Status = Success 00012550910000001723000000012820104100300300305X200807111727325610815014112010200000000000000000000000000000000010201020102000000005146360015500121E2008071117010800MANUAL CASH IN EXIT MANUAL 00004889270000000082000000000100104100300300307X200807111727353911015004453030200000000000000000000000000000072000001020102000000001154220344700103E2008071117070600EZPASS TAG# 008 - 03623801 STATUS = VALID TYPE = INTERIOR FPT Program Status = Success 00012550920000001724000000012800104100300300307X200807111727379411015004453030200000000000000000000000000000072000001020102000000001154230344900401E2008071117181300EZPASS TAG# 006 - 00468916 STATUS = VALID TYPE = INTERIOR FPT Program Status = Success 00012550930000001725000000012800104100300300306X200807111727399610815006608010200000000000000000000000000000000010201020102000000000075910013300613E2008071117032500MANUAL
The out actually gives multiple line...but what should be the approach to read line by line continuously and keep parsing them......
kind regards

Similar Messages

  • Reading lots of bytes from a socket channel

    Hello,
    I have a client/server architecture.
    My server writes() to a socketChannel the contents large byteBuffer.
    On my client, I read() the socketChannel in to a byteBuffer. However, the data I wrote to the socketChannel is so large that it doesn't all arrive in one read(). I get a byteBuffer, but it isn't complete.
    Is there any way to know that there is more data waiting on the socketChannel, as it were? Or do I need to handle this myself by keeping track of the number of incoming bytes?
    Cheers!

    I was wondering whether Java had any kind of internal way of saying "I've not yet finished writing what I was told to write....there's more data to come".Socket.Channel.write() returns a byte count. If it's less that you expect, the write was incomplete.
    I suspect the answer is "no"No, the answer is 'yes', unless you are ignoring the return value.
    The canonical way to write a buffer is this:
    while (buffer.position() > 0)
      try
        buffer.flip();
        int rc = channel.write(buffer);
        if (rc == 0)
            // Here you must register the channel for OP_WRITE
            // and wait for it to trigger before trying again, not shown.
            key.interestOps(SelectionKey.OP_WRITE);
            break;
      finally
        buffer.compact();
    if (buffer.position() == 0)
      // The entire buffer has been written.
      // At this point you deregister the channel for OP_WRITE,
      key.interestOps(0);
      // or more probably re-register for OP_READ.
      key.interestOps(SelectionKey.OP_READ);
    }

  • Read from socket failed: Connection reset by peer

    On Solaris 10 SPARC I have NO problem with establishing SSH connections.
    Here is proof:
    # svcs -a | grep ssh
    online Jun_02 svc:/network/ssh:default...but here is what can be found in /var/adm/messages
    Jun 7 04:09:16 my_host sshd[11701]: [ID 800047 auth.crit] fatal: Read from socket failed: Connection reset by peerTHIS IS IMPORTANT!!!
    This messages does not appear during I establish my ssh connection. It appears irregular.
    Does anyone know whats going on ?

    Hi Darren,
    that would make sense but I just made a test:
    I have opened tail -f /var/adm/messages and from other host:
    - telnet to it on port 22 - no message
    - closed client during establishing connection - still no message
    But I belive you must be right as I see no other possibility...
    Can I turn on more detailed logger in message to be able to see IP address of all host who are trying SSH connection ?
    Edited by: czezz on Jun 25, 2009 10:50 PM

  • Using a selector to detect closed socket channel.

    Basically our app uses one thread to perform a select on multiple socket channels. When a socket is closed (either remotely or locally) the server app needs to unregister the client (so we need to detect closed channels). We've been using blocking IO previously (no dramas), but now we're dealing with many connections/clients we need to rework it as we're getting excessive amounts of threads. Anyway, that's just background.
    Here's the problem we're getting, I have boiled it down to the following.
    SocketChannel channel = SocketChannel.open();
    channel.connect(socketAddress); // for the test this is localhost.
    // this make sure socket is open, remote end just echos, waits 3 seconds and closes the socket.
    channel.write(ByteBuffer.wrap("testLocalSocketClose\n".getBytes()));
    channel.configureBlocking(false);
    Selector selector = Selector.open();
    LOG.fine("registering channel");
    channel.register(selector, SelectionKey.OP_READ, channel);
    LOG.fine("closing channel");
    channel.close();
    LOG.fine("waiting...");
    int i = selector.select();
    // this never happens (or it does very rarely)
    LOG.fine("selector woke with " + i + " selected");I would have expected the selector to return the selection key of the dead channel. Given that it doesn't and this scenario is possible (channel closing just after a read operation but before another select is called - in separate threads obviously). How can we reliably detect/be informed that the channel has been closed?
    (I saw somewhere someone mention adding the OP_WRITE to the key, I have tried this as well and it makes no difference).
    Many Thanks.
    Bob.

    May I suggest you look at your application and reassess; either it's wrong or it's your understanding of what our issue is.
    Please try the simple test below.
    WSADATA ws;
    WSAStartup(0x0101, &ws);
    SOCKET sock = socket(PF_INET, SOCK_STREAM, 0);
    struct sockaddr_in server;
    server.sin_family = AF_INET;
    server.sin_addr.s_addr = htonl(INADDR_ANY);
    server.sin_port = htons(9000);
    cout << "binding" << endl;
    bind(sock, (struct sockaddr *)&server, sizeof(server));
    cout << "listening" << endl;
    listen(sock, SOMAXCONN);
    struct sockaddr_in client;
    int client_size = sizeof(client);
    memset(&client, 0, client_size);
    cout << "accepting" << endl;
    SOCKET clientSock = accept(sock, (struct sockaddr*)&client, &client_size);
    // shutdown socket.
    cout << "shutting down client socket" << endl;
    shutdown(clientSock, SD_BOTH);
    // setup select
    FD_SET fd;
    TIMEVAL tv;
    FD_ZERO(&fd);
    tv.tv_sec  = static_cast<int>(6000);
    tv.tv_usec = 0;
    FD_SET(clientSock, &fd);
    cout << "selecting" << endl;
    int rc = select(0, &fd, NULL, NULL, &tv);     
    cout << rc << ", " << FD_ISSET(clientSock, &fd) << endl;
    char msg[500];
    if (FD_ISSET(clientSock, &fd)) {
         cout << recv(clientSock, msg, 500, 0) << endl;
         cout << WSAGetLastError() << endl;
    cout << "closing" << endl;
    closesocket(clientSock);Telnet to port 9000, you get the following output immediately:
    binding
    listening
    accepting
    shutting down client socket
    selecting
    1, 1
    -1
    10058
    closing
    The solution I posted previously re calling shutdownInput/Output in Java isn't correct however, I left OP_WRITE on by mistake, which always returns ready, my fault.  Apologies.
    Whatever the behaviour, it will be the same for Selector.select() as it is for select().
    Clearly not.
    Edited by: Bawb on 29-Jul-2011 07:01, I had left OP_WRITE on which was returning ready each time, when I realised and took it out I removed the shutdown code which made me think I hadn't sorted this. Apologies again.
    Still reckon an RFE for OP_SHUTDOWN should be added to Java.
    Thanks.

  • Reg. Socket Channel Write Method

    Hi,
    We have the following method to write into the socket channel.
         private void write(SelectionKey key)
              SocketChannel channel = (SocketChannel) key.channel();
              try
                   channel.write(writeBuffer);
                   key.interestOps(SelectionKey.OP_READ);
              catch (IOException ioEx)
                   LogUtility.log(Level.SEVERE, ioEx);
    My doubt is, in case of any network related issues and network goes down, how to trap those exception. In those cases, i need to re-establish the connection again to the remote host.
    I tried to check, whether channel.isConnected b4 writing, but the doc says this will return false if the connect operation is never fired.
    It will be helpful for me, if some one gimme an idea to proceed on this.
    Best Regards,
    K.Sathishkumar

    If you get any IOException or SocketException other than a SocketTimeoutException when doing I/O to a socket or SocketChannel you must close the socket/channel. It is of no further use. What else you do depends on the application - log it, maybe try to re-establish the connection if you are a client, forget about it if you are a server.
    BTW:
    We have the following method to write into the socket channel.
    private void write(SelectionKey key)
    SocketChannel channel = (SocketChannel) key.channel();
    try
    channel.write(writeBuffer);
    key.interestOps(SelectionKey.OP_READ);This is not valid. You shouldn't throw away the result of the write and just assume the data got written as you are doing here. You should do something like this:
    try
      // assuming the buffer is already flipped
      int count;
      while (writeBuffer.hasRemaining() && (count = channel.write(writeBuffer)) > 0)
      if (count == 0)
        key.interestOps(SelectionKey.OP_WRITE);
      else
        key.interestOps(SelectionKey.OP_READ);
    catch (IOException ioEx)
      LogUtility.log(Level.SEVERE, ioEx);
      try
        channel.close();
      catch (IOException ioEx2)
        LogUtility.log(Level.SEVERE, ioEx2);
    // ...}

  • Flex/Zend channel connect failed error...

    Hi guys.
        I am using Flex and php to develop my project. Everything works great in my local machine. However, when I upload my files to my server (godaddy.com). I got the error when loading my flex application.
    The pop-up error message is
    send failed
    channel.connect.failed.error
    Netconnection.call.Badversion: url:
    http://mydomail/folder/gateway.php
    I have upload my ZendFramewrok folder into my server and amf_config.ini has been configured. (webroot =http://mydomain)
    I am not sure what's going on here. Please help. Thanks.
    Update: my gateway.php
    <?php
    ini_set("display_errors", 1);
    $dir = dirname(__FILE__);
    $webroot = $_SERVER['DOCUMENT_ROOT'];
    $configfile = "$dir/amf_config.ini";
    //default zend install directory
    $zenddir = $webroot. '/ZendFramework/library'; //I did upload the ZendFramwork folder
    //Load ini file and locate zend directory
    if(file_exists($configfile)) {
    $arr=parse_ini_file($configfile,true);
    if(isset($arr['zend']['webroot'])){
      $webroot = $arr['zend']['webroot'];
      $zenddir = $webroot. '/ZendFramework/library';
    if(isset($arr['zend']['zend_path'])){
      $zenddir = $arr['zend']['zend_path'];
    // Setup include path
    //add zend directory to include path
    set_include_path(get_include_path().PATH_SEPARATOR.$zenddir);
    // Initialize Zend Framework loader
    require_once 'Zend/Loader/Autoloader.php';
    Zend_Loader_Autoloader::getInstance();
    // Load configuration
    $default_config = new Zend_Config(array("production" => false), true);
    $default_config->merge(new Zend_Config_Ini($configfile, 'zendamf'));
    $default_config->setReadOnly();
    $amf = $default_config->amf;
    // Store configuration in the registry
    Zend_Registry::set("amf-config", $amf);
    // Initialize AMF Server
    $server = new Zend_Amf_Server();
    $server->setProduction($amf->production);
    if(isset($amf->directories)) {
    $dirs = $amf->directories->toArray();
    foreach($dirs as $dir) {
         // get the first character of the path.
         // If it does not start with slash then it implies that the path is relative to webroot. Else it will be treated as absolute path
         $length = strlen($dir);
         $firstChar = $dir;
         if($length >= 1)
          $firstChar = $dir[0];
         if($firstChar != "/"){
          // if the directory is ./ path then we add the webroot only.
          if($dir == "./"){      
           $server->addDirectory($webroot);
          }else{
           $tempPath = $webroot . "/" . $dir;
        $server->addDirectory($tempPath);
      }else{
          $server->addDirectory($dir);     
    // Initialize introspector for non-production
    if(!$amf->production) {
    $server->setClass('Zend_Amf_Adobe_Introspector', '', array("config" => $default_config, "server" => $server));
    $server->setClass('Zend_Amf_Adobe_DbInspector', '', array("config" => $default_config, "server" => $server));
    // Handle request
    echo $server->handle();
    Error from gateway.php if I call it directly.
    Warning: require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/79/4687979/html/parkerList/gateway.php on line 27
    Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader/Autoloader.php' (include_path='.:/usr/local/php5/lib/php:http://blackwheels.info//ZendFramework/library') in /home/content/79/4687979/html/parkerList/gateway.php on line 27
    gateway.php is the rat. but I still can't figure out what's wrong. Zend/Loader/Autoloader.php is under the server root "ZendFramework/library" folder. I don't understand why my application can't find it. Thanks again!

    You will get a better response if you repost your question on the Flex forums. This forum is for the Livecycle Data Services product.

  • Weblogic 11G error = BEA-000449  Closing socket as no data read from it

    In My Weblogic 11G, i am getting Warning msg in my log file saying Closing socket as no data read from it
    ####<Nov 2, 2010 12:10:53 AM IST> <Warning> <Socket> <TradeServer> <TradeServer> <[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <1288636853607> <BEA-000449> <Closing socket as no data read from it on 95.66.7.15:58,089 during the configured idle timeout of 25 secs>
    ####<Nov 2, 2010 12:10:53 AM IST> <Warning> <Socket> <TradeServer> <TradeServer> <[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <1288636853607> <BEA-000449> <Closing socket as no data read from it on 95.66.7.15:58,088 during the configured idle timeout of 25 secs>
    ####<Nov 2, 2010 12:21:37 AM IST> <Info> <JDBC> <TradeServer> <TradeServer> <[ACTIVE] ExecuteThread: '23' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <1288637497701> <BEA-001128> <Connection for pool "IB_JDBC_Data_Source" closed.>
    I have follow the following step
    If you want to follow this solution. Go to Admin console -> Click on Domain->Configuration->Log Filters->create new Log filter.
    I added this line in expression "(MESSAGE !='Closing socket as no data read from it during the configured idle timeout of 5 secs')"
    Go to your server-(for each server you have to set it individually)->Logging->Advanced->Select this log filter for Standard Out or log file.
    My Filter is "(MESSAGE !=Closing socket as no data read from it ')"
    this is not working in weblogic 11G, any one have the solution to stop this msg.
    Edited by: Amar_Shaw on Nov 3, 2010 1:40 PM

    Hi Amar,
    I think you have given the wrong string in the filter, you are getting "*Closing socket as no data read from it on 95.66.7.15:58,089 during the configured idle timeout of 25 secs*" and you have given in the filter "*Closing socket as no data read from it during the configured idle timeout of 5 secs*".
    You can change it and see if that works for you.
    Also the above option is just to suppress the issue which are getting which in this case is fine as its just a warning message, however you can even try to tune few of the follwoing parameters that too would help you to remove this warning message.
    1. Set the parameter -Dweblogic.client.socket.ConnectTimeout=XXX, in the start-up script of the server which you are seeing this issue under JAVA_OPTIONS
    Note: Where "XXX" is the value in ms.
    Example:
    -Dweblogic.client.socket.ConnectTimeout=500
    2. Try tuning the duration time to a higher value from the below Console path
    Server -> Protocols (tab) -> HTTP (sub-tab) -> Duration
    Regards,
    Ravish Mody
    http://middlewaremagic.com/weblogic/
    Middleware Magic | Come, Join Us and Experience The Magic…

  • Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 500

    I get the following error when trying to connect to my BlazeDS Java server from Flex application. Flex application is on localhost:80, blazeDS on tomcat localhost:8080. Please help!
    createUser();faultHandler():(mx.messaging.messages::ErrorMessage)#0
      body = (Object)#1
      clientId = (null)
      correlationId = "9FFDEBE8-EAD0-F3D9-8E9B-E3D7D7F5AE79"
      destination = ""
      extendedData = (null)
      faultCode = "Client.Error.MessageSend"
      faultDetail = "Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 500: url: 'http://77.93.202.150:8080/QuizDS/messagebroker/amf'"
      faultString = "Send failed"
      headers = (Object)#2
      messageId = "98F54E19-7B0D-DCB9-4B86-E3D7D84E484F"
      rootCause = (mx.messaging.events::ChannelFaultEvent)#3
        bubbles = false
        cancelable = false
        channel = (mx.messaging.channels::AMFChannel)#4
          authenticated = false
          channelSets = (Array)#5
          connected = false
          connectTimeout = -1
          enableSmallMessages = true
          endpoint = "http://77.93.202.150:8080/QuizDS/messagebroker/amf"
          failoverURIs = (Array)#6
          id = (null)
          mpiEnabled = false
          netConnection = (flash.net::NetConnection)#7
            client = (mx.messaging.channels::AMFChannel)#4
            connected = false
            maxPeerConnections = 8
            objectEncoding = 3
            proxyType = "none"
            uri = "http://77.93.202.150:8080/QuizDS/messagebroker/amf"
          piggybackingEnabled = false
          polling = false
          pollingEnabled = true
          pollingInterval = 3000
          protocol = "http"
          reconnecting = false
          recordMessageSizes = false
          recordMessageTimes = false
          requestTimeout = -1
          uri = "http://77.93.202.150:8080/QuizDS/messagebroker/amf"
          url = "http://77.93.202.150:8080/QuizDS/messagebroker/amf"
          useSmallMessages = false
        channelId = (null)
        connected = false
        currentTarget = (mx.messaging.channels::AMFChannel)#4
        eventPhase = 2
        faultCode = "Channel.Connect.Failed"
        faultDetail = "NetConnection.Call.Failed: HTTP: Status 500: url: 'http://77.93.202.150:8080/QuizDS/messagebroker/amf'"
        faultString = "error"
        reconnecting = false
        rejected = false
        rootCause = (Object)#8
          code = "NetConnection.Call.Failed"
          description = "HTTP: Status 500"
          details = "http://77.93.202.150:8080/QuizDS/messagebroker/amf"
          level = "error"
        target = (mx.messaging.channels::AMFChannel)#4
        type = "channelFault"
      timestamp = 0
      timeToLive = 0

    halodev:
    I made a CF/Flex site based on the Flexstore sample app,
    using a database instead of XML as the data source; in case you
    want to see it:
    http://www.timos.com/dg/flex/DilemmaGames.html
    At first I had troubles similar to what you describe;
    initially, part of the problem was that my hosting company had not
    yet upgraded to CF 7.02. One other thing I had to correct: when you
    upload to your server, upload the entire ‘bin’ (or
    whatever your output folder is) minus the debug SWF.
    If it would help with other issues, contact me and I will be
    glad to make my project code available to you. Good luck.
    Carlos
    [email protected]

  • When client use socket to connect server, server how to get client IP

    as topic

    Your ServerSocket has an accept() method that gives you a Socket. The Socket class has a getInetAddress() method... I'll let you continue reading the API documentation from here.

  • Remoting Connection Issue: Channel.Connect.Failed

    Solution: Turns out my client had installed a new
    firewall/web management system without telling me. My app was being
    blocked. :(
    Hi there,
    I have a Flex app using remoting and ColdFusion. My client
    has suddenly experienced the following error:
    Channel.Connect.Failed
    NetConnection.Call.BadVersion: url: '
    http://mysite/flex2gateway/'
    The weird thing is the app works when you access it from
    outside of my client's office. I'm wondering if it is some sort of
    firewall issue on their end. Any thoughts?
    Thanks.

    The issue is probably do to a problem with your configuration.  There is probably a destination or endpoint issue.  A nice and short tutorial on this can be found at http://flexbandit.com/archives/55.

  • Getting Channel.Connect.Failed

    I'm building a Flex 3 app, with BlazeDS deploying to Tomcat
    6.0 I have built/Run the example BlazeDS code with out error. When
    I try to access my remote bean from my app I get
    [RPC Fault faultString="Send failed"
    faultCode="Client.Error.MessageSend"
    faultDetail="Channel.Connect.Failed error
    NetConnection.Call.Failed: HTTP: Status 404: url: '
    http://localhost:8400/WebContent/messagebroker/amf'"
    at mx.rpc::AbstractInvoker/
    http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\3.0.x\frameworks\project s\rpc\src\mx\rpc\AbstractInvoker.as:216
    at
    mx.rpc::Responder/fault()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\Responder.as:49 ]
    at
    mx.rpc::AsyncRequest/fault()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AsyncRequest .as:103]
    at
    mx.messaging::ChannelSet/faultPendingSends()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\ messaging\ChannelSet.as:1399]
    at
    mx.messaging::ChannelSet/channelFaultHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\m x\messaging\ChannelSet.as:935]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at
    mx.messaging::Channel/connectFailed()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\messagi ng\Channel.as:997]
    at
    mx.messaging.channels::PollingChannel/connectFailed()[E:\dev\3.0.x\frameworks\projects\rp c\src\mx\messaging\channels\PollingChannel.as:354]
    at
    mx.messaging.channels::AMFChannel/statusHandler()[E:\dev\3.0.x\frameworks\projects\rpc\sr c\mx\messaging\channels\AMFChannel.as:369]

    Hi,
    Can you please try tracing the FaultEvent.fault.rootCause
    object and see if there is any error message. Usually exceptions
    thrown from the server is available in this rootCause object.
    Hope this helps.

  • FaultCode:Client.Error.MessageSend faultDetail:'Channel.Connect.Failed

    Hello Everyone,
    I'm kinda sure a lot of people have to deal with the same error, but I can't solve it using explainations given in other topics. So here it is :
    I'm trying to create a Flex project on Adobe Flash Builder 4.0, using J2EE, BlazeDS and Tomcat6.0.
    To have a good start, I want to try some basic interactions between java & flex. For that, I created a java class with a functions returning a String, witch is called when a button is clicked in my main panel :
    remoting-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <service id="remoting-service"
        class="flex.messaging.services.RemotingService">
        <adapters>
            <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
        </adapters>
        <default-channels>
            <channel ref="my-amf"/>
        </default-channels>
         <destination id="hello">
            <properties>
                <source>test.HelloWorld</source>
                <scope>session</scope>
            </properties>
        </destination>
    </service>
    HelloWorld.java
    package test;
    public class HelloWord {
        public String sayHello()
            return "Hello from Java";
    project.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="1000" minHeight="600">
        <s:Button x="200" y="200" label="Button4" click="callHello(event)"/>
        <fx:Declarations>
            <s:RemoteObject id="roHello"
                            destination="hello"
                            fault="onFault('roHello',event)">
                <s:method name="sayHello"
                          result="onResult(event)"
                          fault="onFault('roHello.sayHello',event)"/>           
            </s:RemoteObject>
        </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import mx.controls.Alert;
                import mx.rpc.events.FaultEvent;
                import mx.rpc.events.ResultEvent;
                import mx.rpc.remoting.RemoteObject;
                private function callHello(event:MouseEvent):void
                    roHello.sayHello() as String;
                private function onResult(event : ResultEvent) : void
                    var retour:String;
                    retour = event.result as String;
                    //Alert.show(event.result.toString());
                    Alert.show("success::"+retour);
                private function onFault(remoteObject : String, event : FaultEvent) : void
                    Alert.show(event.fault.message);
                    //Alert.show("fault");
            ]]>
        </fx:Script>
    </s:Application>
    When I launch my application, the button is created. But as soon as I click on it, I got the following message :
    faultCode:Client.Error.MessageSend faultString:'Echec de l'envoi' faultDetail:'Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url: 'http://localhost:8080/WebContent/messagebroker/amf''
    any idea how to solve it ?

    I've resolved my issue. Perhaps you are correct that my tokens were not resolving, but since you did not offer a way to fix that, I was still on my own. There was nothing helpful that I could find in the console or log.
    I found this article, and after using his architecture (using an external config file to define the amf endpoint at runtime) I was able to connect to the back end. I was also looking for a good way to externalize information, so I recommend reading this article:
    http://coenraets.org/blog/2009/03/externalizing-service-configuration-using-blazeds-and-lc ds/

  • Channel Connection Failed  HTTP 405

    I've got the -services-config.xml set up and pointed to
    complie in Flex, but I'm getting these errors:
    Send failed - then I hit "OK"
    Channel.Connect.Failed error NetConnection.Call.Failed: HTTP:
    Status 405: url: '
    http://mySite.com/flex2gateway/'
    I've read several posts and created a new channel that does
    not point to the "localhost:port" and channel-definition id. It
    looks something like this:
    <endpoint uri="
    http://mySite.com/flex2gateway/"
    class="flex.messaging.endpoints.AMFEndpoint"/>
    I'm using Flex 3, so I don't know if there is any issues with
    it. Any suggestions would be greatly appreciated!

    Found the problem. In case anyone else runs into this issue:
    On your Server you need Coldfusion version 7.0.2 at the
    minimum. When you goto the URL of
    http://x.x.x.x/flex2gateway
    in a web browser you should get a white blank page. Also make sure
    that you have a tab within the CF Administrator under Data &
    Services called Flex Intergration. I have had these same issues and
    found that my Production Server did not have the Flex Intergration
    so I had to Uninstall CF7 and ReInstall 7.0.2 to get the Flex
    Intergration.

  • HT4796 I´m trying to migrate from my old PC to my mac, but in the migration assistance of my PC, the legend "waiting for your mac to connect" continues ever for ever, never appears the passcode. What can I do?

    I´m trying to migrate from my old PC to my mac, but in the migration assistance of my PC, the legend "waiting for your mac to connect" continues ever for ever, never appears the passcode. What can I do?

    The transfer of content from sources such as songs imported from CD is designed by default to be one way from iTunes to iPod. However there are a number of third party utilities that you can use to retrieve music files and playlists from your iPod. I use Senuti but have a look at the web pages and documentation for the others too, you'll find that they have varying degrees of functionality and some will transfer movies, videos, photos and games as well. This is just a small selection of what's available, you can read reviews and comparisons of some of them here:
    Wired News - Rescue Your Stranded Tunes
    Comparison of iPod managers
    Senuti Mac Only (Currently only the beta version is iPod Touch & iPhone compatible)
    PodView Mac Only
    PodWorks Mac Only
    iPodDisk PPC Mac Only (experimental version available for Intel Macs)
    TuneAid Mac only (iPhone and iPod Touch compatible)
    iPodRip Mac & Windows
    YamiPod Mac & Windows
    Music Rescue Mac & Windows
    iPod Music Liberator Mac & Windows
    iGadget Mac & Windows (iPhone and iPod Touch compatible)
    Floola Mac & Windows
    iRepo Mac & Windows (iPhone and iPod Touch compatible)
    iPod Access Mac & Windows (iPhone and iPod Touch compatible)
    TouchCopy Mac & Windows (iPhone and iPod Touch compatible)
    There's also a manual method of copying songs from your iPod to a Mac or PC. The procedure is a bit involved and won't recover playlists but if you're interested it's available on page 2 at this link: Copying Content from your iPod to your Computer - The Definitive Guide

  • BEA-000449  Closing socket as no data read from it

    This error message is filling up the server log files. It looks like some network problem. How can I find the cause ? This does not create a functional problem, but I am sure there will be a performance problem. Also, since this message is filling up the logs rapidly, I cannot see my regular application debug statements.
    <Warning> <Socket> <myserver.mydomain.net> <my_managedserver_01> <[ACTIVE] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1218554019557> <BEA-000449> <Closing socket as no data read from it during the configured idle timeout of 30 secs>
    The timeout of 30 seconds is the value set in Login Timeout in server tuning tab.
    Environment:
    WebLogic Portal 10.0 MP1 (The domain is a server domain, not portal domain)
    Red Hat linux 4
    Intel Xeon
    Message was edited by:
    prakashp

    In My Weblogic 11G, i am getting Warning msg in my log file saying Closing socket as no data read from it
    ####<Nov 2, 2010 12:10:53 AM IST> <Warning> <Socket> <TradeServer> <TradeServer> <[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1288636853607> <BEA-000449> <Closing socket as no data read from it on 95.66.7.15:58,089 during the configured idle timeout of 25 secs>
    ####<Nov 2, 2010 12:10:53 AM IST> <Warning> <Socket> <TradeServer> <TradeServer> <[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1288636853607> <BEA-000449> <Closing socket as no data read from it on 95.66.7.15:58,088 during the configured idle timeout of 25 secs>
    ####<Nov 2, 2010 12:21:37 AM IST> <Info> <JDBC> <TradeServer> <TradeServer> <[ACTIVE] ExecuteThread: '23' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1288637497701> <BEA-001128> <Connection for pool "IB_JDBC_Data_Source" closed.>
    I have follow the following step
    If you want to follow this solution. Go to Admin console -> Click on Domain->Configuration->Log Filters->create new Log filter.
    I added this line in expression "(MESSAGE !='Closing socket as no data read from it during the configured idle timeout of 5 secs')"
    Go to your server-(for each server you have to set it individually)->Logging->Advanced->Select this log filter for Standard Out or log file.
    this is not working in weblogic 11G, any one have the solution to stop this msg.

Maybe you are looking for