我正在使用Thrift(Java服务器,C#客户端)。 我收到此错误 Thrift.Transport.TTransportException 。我一直在调试,我的程序停在:
TMessage msg = iprot_.ReadMessageBegin();
在thrift中生成的服务中的C#方法 recv_getCopii():
public List<Copil> getCopii(Proba proba)
{
#if !SILVERLIGHT
send_getCopii(proba);
return recv_getCopii();
#else
var asyncResult = Begin_getCopii(null, null, proba);
return End_getCopii(asyncResult);
#endif
}
#if SILVERLIGHT
public IAsyncResult send_getCopii(AsyncCallback callback, object state, Proba proba)
#else
public void send_getCopii(Proba proba)
#endif
{
oprot_.WriteMessageBegin(new TMessage("getCopii", TMessageType.Call, seqid_));
getCopii_args args = new getCopii_args();
args.Proba = proba;
args.Write(oprot_);
oprot_.WriteMessageEnd();
#if SILVERLIGHT
return oprot_.Transport.BeginFlush(callback, state);
#else
oprot_.Transport.Flush();
#endif
}
public List<Copil> recv_getCopii()
{
TMessage msg = iprot_.ReadMessageBegin();
if (msg.Type == TMessageType.Exception) {
TApplicationException x = TApplicationException.Read(iprot_);
iprot_.ReadMessageEnd();
throw x;
}
getCopii_result result = new getCopii_result();
result.Read(iprot_);
iprot_.ReadMessageEnd();
if (result.__isset.success) {
return result.Success;
}
if (result.__isset.ce) {
throw result.Ce;
}
throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "getCopii failed: unknown result");
}
我在Java中遇到这个错误:
18717 [main] ERROR org.apache.thrift.server.TSimpleServer - Error occurred during processing of message.
java.lang.NullPointerException
at concurs.server.ConcursService$getCopii_result$getCopii_resultStandardScheme.write(ConcursService.java:4287)
at concurs.server.ConcursService$getCopii_result$getCopii_resultStandardScheme.write(ConcursService.java:4226)
at concurs.server.ConcursService$getCopii_result.write(ConcursService.java:4172)
at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:55)
at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
at org.apache.thrift.server.TSimpleServer.serve(TSimpleServer.java:80)
at concurs.StartObjectServer.main(StartObjectServer.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
18717 [main] WARN org.apache.thrift.transport.TIOStreamTransport - Error closing output stream.
java.net.SocketException: Socket closed
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:116)
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at java.io.FilterOutputStream.close(FilterOutputStream.java:158)
at org.apache.thrift.transport.TIOStreamTransport.close(TIOStreamTransport.java:110)
at org.apache.thrift.transport.TSocket.close(TSocket.java:235)
at org.apache.thrift.server.TSimpleServer.serve(TSimpleServer.java:102)
at concurs.StartObjectServer.main(StartObjectServer.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)