2013-08-29 2 views
0

Я пытаюсь установить соединение с java-сервером. Это код PHP:Thrift Fatal error: исключение uncaught

<?php 

$GLOBALS['THRIFT_ROOT'] = 'root'; 
/*Remember these two files? */ 
require_once 'Types.php'; 
require_once 'MachineControl.php'; 
/* Dependencies. In the proper order. */ 
require_once $GLOBALS['THRIFT_ROOT'].'/Thrift/Transport/TTransport.php'; 
require_once $GLOBALS['THRIFT_ROOT'].'/Thrift/Transport/TSocket.php'; 
require_once $GLOBALS['THRIFT_ROOT'].'/Thrift/Exception/TException.php'; 
require_once $GLOBALS['THRIFT_ROOT'].'/Thrift/Exception/TApplicationException.php'; 
require_once $GLOBALS['THRIFT_ROOT'].'/Thrift/Base/TBase.php'; 
require_once $GLOBALS['THRIFT_ROOT'].'/Thrift/Protocol/TProtocol.php'; 
require_once $GLOBALS['THRIFT_ROOT'].'/Thrift/Protocol/TBinaryProtocol.php'; 
require_once $GLOBALS['THRIFT_ROOT'].'/Thrift/Transport/TBufferedTransport.php'; 
require_once $GLOBALS['THRIFT_ROOT'].'/Thrift/Type/TMessageType.php'; 
require_once $GLOBALS['THRIFT_ROOT'].'/Thrift/Factory/TStringFuncFactory.php'; 
require_once $GLOBALS['THRIFT_ROOT'].'/Thrift/StringFunc/TStringFunc.php'; 
require_once $GLOBALS['THRIFT_ROOT'].'/Thrift/StringFunc/Core.php'; 
require_once $GLOBALS['THRIFT_ROOT'].'/Thrift/Type/TType.php'; 
use Thrift\Protocol\TBinaryProtocol; 
use Thrift\Transport\TSocket; 
use Thrift\Transport\TSocketPool; 
use Thrift\Transport\TFramedTransport; 
use Thrift\Transport\TBufferedTransport; 
$host = '192.168.129.117'; 
$port = 9090; 
$socket = new Thrift\Transport\TSocket($host, $port); 
$transport = new TBufferedTransport($socket); 
$protocol = new TBinaryProtocol($transport); 
// Create a calculator client 
$client = new MachineControlClient($protocol); 
$transport->open(); 
echo "Eror: " . $client ->getError(); ?> 

У меня есть связь с Java-сервера. Но мой результат в файле test.php будет:

Fatal error: Uncaught exception 'Thrift\Exception\TApplicationException' with message 'Internal error processing getError' in C:\xampp\htdocs\jasa\thrift\MachineControl.php:877 Stack trace: #0 C:\xampp\htdocs\jasa\thrift\MachineControl.php(845): MachineControlClient->recv_getError() #1 C:\xampp\htdocs\jasa\thrift\test.php(34): MachineControlClient->getError() #2 {main} thrown in C:\xampp\htdocs\jasa\thrift\MachineControl.php on line 877 

Что происходит не так? Все файлы и классы находятся в файле, класс GetError выглядит следующим образом:

public function getError() 
    { 
    $this->send_getError(); 
    return $this->recv_getError(); 
    } 

    public function send_getError() 
    { 
    $args = new \MachineControl_getError_args(); 
    $bin_accel = ($this->output_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary'); 
    if ($bin_accel) 
    { 
     thrift_protocol_write_binary($this->output_, 'getError', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); 
    } 
    else 
    { 
     $this->output_->writeMessageBegin('getError', TMessageType::CALL, $this->seqid_); 
     $args->write($this->output_); 
     $this->output_->writeMessageEnd(); 
     $this->output_->getTransport()->flush(); 
    } 
    } 

    public function recv_getError() 
    { 
    $bin_accel = ($this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_read_binary'); 
    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\MachineControl_getError_result', $this->input_->isStrictRead()); 
    else 
    { 
     $rseqid = 0; 
     $fname = null; 
     $mtype = 0; 

     $this->input_->readMessageBegin($fname, $mtype, $rseqid); 
     if ($mtype == TMessageType::EXCEPTION) { 
     $x = new TApplicationException(); 
     $x->read($this->input_); 
     $this->input_->readMessageEnd(); 
     throw $x; 
     } 
     $result = new \MachineControl_getError_result(); 
     $result->read($this->input_); 
     $this->input_->readMessageEnd(); 
    } 
    if ($result->success !== null) { 
     return $result->success; 
    } 
    throw new \Exception("getError failed: unknown result"); 
    } 

Большое спасибо за ваше время, чтобы обсудить этот вопрос;)

ответ

0

Что-то было не так в сервере эта тема будет закрыта

Смежные вопросы