简体   繁体   中英

Read call frame size failed issue with Apache Thrift Async Client

im developing a Apache Thrift Server / Async Client application. But when i call the async Method Callback, i got this error:

java.io.IOException: Read call frame size failed
at org.apache.thrift.async.TAsyncMethodCall.doReadingResponseSize(TAsyncMethodCall.java:234)
at org.apache.thrift.async.TAsyncMethodCall.transition(TAsyncMethodCall.java:192)
at org.apache.thrift.async.TAsyncClientManager$SelectThread.transitionMethods(TAsyncClientManager.java:143)
at org.apache.thrift.async.TAsyncClientManager$SelectThread.run(TAsyncClientManager.java:113)

I did some research here on stackoverflow but nothing works for me.

This is my Server Code:

/**
 * initialisiert die @see {ClientAccessPointImpl} Verbindung, damit der Client eine Verbindung mit dem Serve
 * aufbauen kann
 */
private void initialisiereThriftServer( )
{
    clientAccessPoint = new LoginAndRegisterServiceImpl();
    processor = new Processor<>( clientAccessPoint );

    Runnable server = new Runnable()
    {

        @Override
        public void run( )
        {
            try
            {

                TNonblockingServerSocket serverTransport = new TNonblockingServerSocket(
                        ApplicationConfigurationLoader.getIntProperty( "core.thrift.port" ) );
                TProtocolFactory protocolFactory = new TBinaryProtocol.Factory();
                TServer server = new TThreadedSelectorServer( new TThreadedSelectorServer.Args( serverTransport )
                        .protocolFactory( protocolFactory ).inputTransportFactory( new TFramedTransport.Factory() )
                        .outputTransportFactory( new TFramedTransport.Factory() ).processor( processor )
                        .workerThreads(
                                ApplicationConfigurationLoader.getIntProperty( "core.thrift.workerThreads" ) ) );
                server.serve();
            }
            catch ( TTransportException e )
            {
                LOGGER.log( Level.SEVERE , "Der Server konnte nicht gestartet werden!" , e );
            }

        }
    };

    new Thread( server ).start();
}

Has anyone a idea why this code failed? i used an NonblockingSocket which use a TFramedTransport, i read about this....

Hope you can help me! Jonas

The above code looks fine to me. As you didn't attach the code for processor, I assume that's where the exception come from. Please make sure you are using AsyncProcessor instead of simply Processor

The server Processor should not matter as that is meant for how the server code processes, not the client.

Make sure your client is configured in the same way. Binary vs. Compact, framed, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM