简体   繁体   English

进度ABL-批处理文件运行并写入日志,但不会执行.jar

[英]Progress ABL - Batch file runs and writes to log, but won't execute .jar

I have written a java program that needs to be executed within a batch file. 我写了一个Java程序,需要在批处理文件中执行。 When I run the program that executes the batch file, the batch file will create and write to the appropriate logs, but will not run the executable jar. 当我运行执行批处理文件的程序时,批处理文件将创建并写入相应的日志,但不会运行可执行jar。

My batch file: 我的批处理文件:

SETLOCAL ENABLEEXTENSIONS
SET me=%~n0
SET parent=%~dp0
SET log=C:\apps\HL7\src\Error_log\Pipeline_batch_log.txt

ECHO /* ************************* Error Log Initiated ************************* */ >> %log%
ECHO %DATE:~10,4%:%DATE:~4,2%:%DATE:~7,2%-%TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2% >> %log%
ECHO %parent% >> %log%
ECHO %me% >> %log%

CD c:\apps\HL7\src

IF %ERRORLEVEL% NEQ 0 (
ECHO error - CD failed. >> %log%
)

ECHO java -jar HL7toSS.jar "%1" "%2" "%3" "%4" "%3" "%4" >> %log%

java -jar HL7toSS.jar "%1" "%2" "%3" "%4" "%3" "%4">> %log%

DEL c:\apps\HL7\src\%2

IF %ERRORLEVEL% NEQ 0 (
ECHO error - HL7 xml file did not delete. >> %log%
)

ECHO /* ****************************** END OF LOG ****************************** */ >> %log%

EXIT

As you can see, I log the output from the executable jar, but it is silent (I'm assuming because it doesn't ever run). 如您所见,我记录了可执行jar的输出,但是它是静默的(我假设是因为它从未运行过)。 I also log the command that should be running; 我还记录了应该运行的命令; copying this command and running it in Command Prompt works just fine. 复制此命令并在命令提示符中运行就可以了。

Here is the output I'm seeing in my log file 这是我在日志文件中看到的输出

/* ************************* Error Log Initiated ************************* */ 
2017:05:31-14:38:16 
C:\APPS\HL7\src\ 
Pipeline_batch 
Infile: Inbound_EDI_Files\test_1.txt HL7file: HL7_XML_Files\793723096202_HL7_test_1.xml MPAXMLfile: C:\apps\HL7\src\Processed_SS_Files\successful\793723096202_SS_test_1.xml MPAXMLERRfile: Processed_SS_Files\failed\793723096202_ERR_test_1.xml BIOMEDXMLfile: C:\apps\HL7\src\Processed_SS_Files\successful\793723096202_SS_test_1.xml BIOMEDXMLERRfile: Processed_SS_Files\failed\793723096202_ERR_test_1.xml 
java -jar HL7toSS.jar "Inbound_EDI_Files\test_1.txt" "HL7_XML_Files\793723096202_HL7_test_1.xml" "C:\apps\HL7\src\Processed_SS_Files\successful\793723096202_SS_test_1.xml" "Processed_SS_Files\failed\793723096202_ERR_test_1.xml" "C:\apps\HL7\src\Processed_SS_Files\successful\793723096202_SS_test_1.xml" "Processed_SS_Files\failed\793723096202_ERR_test_1.xml"  
/* ****************************** END OF LOG ****************************** */ 

Copying and pasting the same command in the Command Prompt yields the following expected results 在命令提示符中复制和粘贴相同的命令会产生以下预期结果

c:\APPS\HL7\src>java -jar HL7toSS.jar "Inbound_EDI_Files\test_1.txt" "HL7_XML_Fi
les\793722688601_HL7_test_1.xml" "C:\apps\HL7\src\Processed_SS_Files\successful\
793722688601_SS_test_1.xml" "Processed_SS_Files\failed\793722688601_ERR_test_1.x
ml" "C:\apps\HL7\src\Processed_SS_Files\successful\793722688601_SS_test_1.xml" "
Processed_SS_Files\failed\793722688601_ERR_test_1.xml"
Processing: main
Processing: Convert to XML
Finished: Convert to XML
Processing: Choose
Finished: Choose
Skipping: MPA XSLT operator: Input is not available.
Skipping: MPA Validate operator: Input is not available.
Processing: BIOMED XSLT operator
Finished: BIOMED XSLT operator
Processing: BIOMED Validate operator
Finished: BIOMED Validate operator
Finished: main

c:\APPS\HL7\src>

Do you see anything that would be causing the batch file to fail silently when attempting to run the jar? 在尝试运行jar时,是否看到任何导致批处理文件静默失败的内容?

EDIT: 编辑:

Running the batch file itself from the command prompt also works. 从命令提示符运行批处理文件本身也可以。 The issue seems to stem from the calling program, which is a Progress ABL procedure. 该问题似乎源于调用程序,该程序是Progress ABL过程。 The ABL procedure is executing the batch file as follows: ABL过程正在执行批处理文件,如下所示:

ASSIGN runthis = "C:\apps\HL7\src\Pipeline_batch.bat " + INpath + " " + HL7path + " " + SSpath + " " + XML-ERRpath.

OS-COMMAND SILENT VALUE(runthis).

We know the parameters being passed into the batch file are correct because of the log. 我们知道由于日志的原因,传递到批处理文件中的参数是正确的。

EDIT 2: 编辑2:

Everything works expected on my local machine. 一切都可以在我的本地计算机上运行。 It is only on the server that this problem occurs. 仅在服务器上会出现此问题。 My hunch is that this has to do with the server's installation of Progress being different somehow from the installation on my local machine. 我的直觉是,这与服务器的Progress安装与本地计算机上的安装有所不同。 I'm now in need of a Progress Wizard. 我现在需要进度向导。

I suspect that the problem is the following: 我怀疑是以下问题:

As explained here in order to successfully run a Java program you must ensure that the PATH env variable is correctly set. 正如解释这里为了成功地运行Java程序,你必须确保PATH环境变量设置正确。

When you test on your dev machine, or when you launch the batch file on the prod machine manually, from your own user profile, the PATH is correct, and everything works. 当您在开发机上进行测试时,或者在您自己的用户配置文件中手动在生产机上启动批处理文件时,PATH是正确的,并且一切正常。

When you are running the ABL program it runs (probably) with different environment variables, and therefore it either cannot find "java" or it is missing some other important configuration element (java libraries/jars, maybe?). 当您运行ABL程序时(可能)它使用不同的环境变量运行,因此它找不到“ java”,或者缺少一些其他重要的配置元素(也许是Java库/ jar)。

Try to see what the PATH value is when invoked from inside the ABL execution context. 尝试查看从ABL执行上下文内部调用时PATH值是什么。 Try for example: 尝试例如:

OS-COMMAND SILENT VALUE("set PATH").

and compare it with what you get from doing "set PATH" from your command line. 并将其与通过命令行执行“ set PATH”得到的结果进行比较。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM