In our project the Java webservice communicate with the backend program written in C and Perl to process. We are using the ProcessBuilderto execute a backend (UNIX) job FrameworkHandler.

在我们的项目中,Java Web服务与用C和Perl编写的后端程序进行通信以进行处理。我们正在使用ProcessBuilderto执行后端(UNIX)作业FrameworkHandler。

ProcessBuilder process;
process.Start(FrameworkHandler -a ACTION)

FrameworkHandler invokes a Perl script to perform some action. The Perl script internally does a diff command between two XML files and uses the print function to print the error:

FrameworkHandler调用Perl脚本来执行某些操作。 Perl脚本在内部在两个XML文件之间执行diff命令,并使用print函数来打印错误:

sub print_error
{
    $err_msg = shift;
    print STDERR "$err_msg\n";
}

Whenever there is a difference between the files the Perl program hangs in the print_error function. If we execute the Perl program in the UNIX shell it is working without any issues. But if we execute the Perl through the webservice, it is not returning after the diff command. Due to this, the webservice is also not returning the response. Whether the greater than (>) symbols in the XML tags are creating problem?

每当文件之间存在差异时,Perl程序就会在print_error函数中挂起。如果我们在U​​NIX shell中执行Perl程序,它可以正常工作。但是如果我们通过webservice执行Perl,它就不会在diff命令之后返回。因此,Web服务也没有返回响应。 XML标记中的大于(>)符号是否会产生问题?

Any help is much appreciated.

任何帮助深表感谢。

Part of Error:

部分错误:


< diff -udr --new-file --label=postProcess1 --label=postProcess2 postProcess1 postProcess2
< --- postProcess1
< +++ postProcess2
< @@ -124,6 +124,36 @@
<               <LOCATION></LOCATION>
<               <ADDRESS_PART1>Test Address ^D</ADDRESS_PART1 >
<         </address_details>
< +       <address_details>
< +             <CITY></CITY>
< +             <STATE>12</STATE>

Thanks, Mathew Liju

谢谢,Mathew Liju

1 个解决方案

#1


3

The API docs say:

API文档说:

“Because some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, and even deadlock.”

“由于某些本机平台仅为标准输入和输出流提供有限的缓冲区大小,因此无法及时写入输入流或读取子进程的输出流可能导致子进程阻塞,甚至死锁。”

Are you complying?

你遵守了吗?

更多相关文章

  1. 作为一只程序猿,我要说说IT业的研发工程师!
  2. 2016年团体程序设计天梯赛-初赛 - 重要的话说三遍 - Java
  3. java程序运行机制和jvm
  4. java的学习方法(转自黑马程序员)
  5. 黑马程序员 Java中根据YYYY-MM-DD格式的日期计算为星期几的两种
  6. 黑马程序员-Java基础总结11——IO流(二)
  7. Java借助Runtime调用外部程序阻塞的代码
  8. Java:创建程序以查找圆柱体的表面积和体积

随机推荐

  1. 【Monkey】Android(安卓)Monkey autotest
  2. android中的文本框
  3. android:padding和android:margin的区别
  4. Handler&Looper
  5. Android 创建服务器 NanoHttpd
  6. 关于Android菜单上的记录
  7. android仿今日头条App、多种漂亮加载效果
  8. 开放平台的Android SDK
  9. android Switch控件
  10. Android日记之2012/02/10——Android中的