节俭致命错误:未捕获的异常

时间:2013-08-29 07:44:31

标签: java php

我正在尝试与java服务器建立连接。 这是php代码:

<?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-server有联系。但我在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");
  }

非常感谢您抽出时间讨论这个问题;)

1 个答案:

答案 0 :(得分:0)

服务器中出现问题,此主题将被关闭