thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dylan Yang <dy...@point.io>
Subject Fwd: Apache Thrift iOS Client cannot get data from Play server
Date Wed, 26 Nov 2014 15:58:45 GMT
This is my Thrift IDL i generated used for Cocoa,Python and Scala
Playframework,

namespace scala point.io.thrift
service ProcessTypesThrift {
    string getProcessTypes();}

For the server side, i use Scrooge and Finagle to generate native Thrift
Scala code and use Play framework build a Thrift server written by Scala.
For the client side, the Thrift code is generated by native Thrift code
generator, and i use cocoa and python to build clients for test. The result
is that python client can get the response from the Play server to make
sure the server is running properly. However, the cocoa client cannot get
any response from the server, and throws exceptions as follows.

Here is my cocoa code:

ProcessTypesThriftClient *server;
    NSLog(@"This is the log info: ...");
    TSocketClient *transport = [[TSocketClient alloc]
initWithHostname:@"localhost" port:9091];
    NSLog(@"Complete init *transport");
    TBinaryProtocol *protocol = [[TBinaryProtocol alloc]
initWithTransport:transport strictRead:YES strictWrite:YES];
    NSLog(@"Complete init *protocol");
    server = [[ProcessTypesThriftClient alloc] initWithProtocol:protocol];
    NSLog(@"Complete init server");
    NSLog(@"Receiving data...");
    NSString *str = [server getProcessTypes];    // receive data
    NSLog(@"Complete received data");
    NSLog(@"str%@",str);
    NSLog(@"done!");

And this is the exception as listed:

2014-11-20 13:08:06.801 ThriftClient3[10983:524097] This is the log
info: ...2014-11-20 13:08:06.817 ThriftClient3[10983:524097] Complete
init *transport2014-11-20 13:08:06.818 ThriftClient3[10983:524097]
Complete init *protocol2014-11-20 13:08:06.818
ThriftClient3[10983:524097] Complete init server2014-11-20
13:08:06.819 ThriftClient3[10983:524097] Receiving data...2014-11-20
13:08:06.850 ThriftClient3[10983:524097] *** Terminating app due to
uncaught exception 'TTransportException', reason: 'Error writing to
transport output stream.'*** First throw call stack:(
    0   CoreFoundation                      0x000000010aa74f35
__exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010a2ffbb7
objc_exception_throw + 45
    2   ThriftClient3                       0x0000000109db7e0e
-[TNSStreamTransport write:offset:length:] + 334
    3   ThriftClient3                       0x0000000109dae8c9
-[TBinaryProtocol writeI32:] + 137
    4   ThriftClient3                       0x0000000109dae683
-[TBinaryProtocol writeMessageBeginWithName:type:sequenceID:] + 115
    5   ThriftClient3                       0x0000000109db3801
-[ProcessTypesThriftClient send_getProcessTypes] + 81
    6   ThriftClient3                       0x0000000109db3adb
-[ProcessTypesThriftClient getProcessTypes] + 43
    7   ThriftClient3                       0x0000000109db1808
-[ViewController viewDidLoad] + 376
    8   UIKit                               0x000000010b02da90
-[UIViewController loadViewIfRequired] + 738
    9   UIKit                               0x000000010b02dc8e
-[UIViewController view] + 27
    10  UIKit                               0x000000010af4cca9
-[UIWindow addRootViewControllerViewIfPossible] + 58
    11  UIKit                               0x000000010af4d041
-[UIWindow _setHidden:forced:] + 247
    12  UIKit                               0x000000010af5972c
-[UIWindow makeKeyAndVisible] + 42
    13  UIKit                               0x000000010af04061
-[UIApplication
_callInitializationDelegatesForMainScene:transitionContext:] + 2628
    14  UIKit                               0x000000010af06d2c
-[UIApplication _runWithMainScene:transitionContext:completion:] +
1350
    15  UIKit                               0x000000010af05bf2
-[UIApplication workspaceDidEndTransaction:] + 179
    16  FrontBoardServices                  0x000000010d2222a3
__31-[FBSSerialQueue performAsync:]_block_invoke + 16
    17  CoreFoundation                      0x000000010a9aa53c
__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    18  CoreFoundation                      0x000000010a9a0285
__CFRunLoopDoBlocks + 341
    19  CoreFoundation                      0x000000010a9a0045
__CFRunLoopRun + 2389
    20  CoreFoundation                      0x000000010a99f486
CFRunLoopRunSpecific + 470
    21  UIKit                               0x000000010af05669
-[UIApplication _run] + 413
    22  UIKit                               0x000000010af08420
UIApplicationMain + 1282
    23  ThriftClient3                       0x0000000109db6483 main + 115
    24  libdyld.dylib                       0x000000010cbf6145 start + 1)
libc++abi.dylib: terminating with uncaught exception of type
TTransportException(lldb)

I use xcode 6.1 and Thrift 0.9.1 to running my cocoa project. Anybody could
point out how to solve this problem would appreciate.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message