我在Java上测试Thrift,但是此代码给了我一些错误。

        ClientVoiceToTextHandler handler = new ClientVoiceToTextHandler();
        ClientVoiceToText.Processor<ClientVoiceToTextHandler> processor = new ClientVoiceToText.Processor<ClientVoiceToTextHandler>(handler);
        TServerTransport serverTransport = new TServerSocket(YSConfig.getInstance().ThriftPort);
        TServer server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(processor));


客户端连接错误:

    22:16:12.553 [pool-3-thread-5] ERROR o.a.thrift.server.TThreadPoolServer - Error occurred during processing of message.
java.lang.NullPointerException: null
    at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:34) ~[libthrift-0.9.0-snapshot.jar:0.9.0-snapshot]
    at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34) ~[libthrift-0.9.0-snapshot.jar:0.9.0-snapshot]
    at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:176) ~[libthrift-0.9.0-snapshot.jar:0.9.0-snapshot]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0_01]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.7.0_01]
    at java.lang.Thread.run(Thread.java:722) [na:1.7.0_01]


因此,我决定像在c ++应用程序中一样传递给TNonblockingServer,但我不知道如何

最佳答案

这可以帮助-http://www.javacodegeeks.com/2012/03/apache-thrift-quickstart-tutorial.html

10-07 19:01
查看更多