thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Viktor Rudnev <>
Subject Python-Java Issue
Date Thu, 06 Jun 2013 10:47:09 GMT

I've recently tried to connect Python to Java using Thrift.

I've written a server on Python (PyPy). I've also written a working
reference client for it.

Then I've written a Java client. When I'm trying to run it I'm getting only
a 'Connection refused' exception.

What am i doing wrong? (Recently I've also found a closed issue featuring
this problem

Used Thrift 0.9 release, PyPy 2.0 beta 2, Java 1.7.0_11.

Thanks for reply.


namespace java com.test
namespace python test

service TestPing {
   void ping()}

*Python server code*

class TestPingHandler:
  def ping(self):

handler = TestPingHandler()
processor = TestPing.Processor(handler)
transport = TSocket.TServerSocket(port=9091)
tfactory = TTransport.TBufferedTransportFactory()
pfactory = TBinaryProtocol.TBinaryProtocolFactory()

server = TServer.TThreadedServer(processor, transport, tfactory, pfactory)

print 'Starting the server...'
print 'done.'

*Java client code*

TTransport transport;
transport = new TSocket("localhost", 9091);;TProtocol protocol = new TBinaryProtocol(transport);
client = new TestPing.Client(protocol);;

*Reference Python client code*

transport = TSocket.TSocket('localhost', 9091)
transport = TTransport.TBufferedTransport(transport)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
client = TestPing.Client(protocol)



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