티스토리 뷰

개발

[thrift] TTransportException

달리는개발자 2012. 1. 5. 13:40
서버와 클라이언트간에 interface 가 다른 경우 다음과 같은 오류가 발생한다.
Client API가 동일한지 재배포해서 확인한다.

org.apache.thrift.transport.TTransportException
 at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)
 at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
 at org.apache.thrift.transport.TFramedTransport.readFrame(TFramedTransport.java:129)
 at org.apache.thrift.transport.TFramedTransport.read(TFramedTransport.java:101)
 at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
 at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:378)
 at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:297)
 at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:204)
 at org.apache.thrift.protocol.TProtocolDecorator.readMessageBegin(TProtocolDecorator.java:116)
 at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)
 at com.bnsworks.mwp.usermgmt.rpc.IU104$Client.recv_call(IU104.java:73)
 at com.bnsworks.mwp.usermgmt.rpc.IU104$Client.call(IU104.java:60)
 at com.bnsworks.mwp.usermgmt.TestIU104.test(TestIU104.java:62)

 
public int read(byte[] buf, int off, int len) throws TTransportException {
    if (inputStream_ == null) {
      throw new TTransportException(TTransportException.NOT_OPEN, "Cannot read from null inputStream");
    }
    int bytesRead;
    try {
      bytesRead = inputStream_.read(buf, off, len);
    } catch (IOException iox) {
      throw new TTransportException(TTransportException.UNKNOWN, iox);
    }
    if (bytesRead < 0) {
      throw new TTransportException(TTransportException.END_OF_FILE);
    }
    return bytesRead;
  }



bytesRead가 0보다 작아서 TTransportException 발생
반응형
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함