简体   繁体   中英

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. 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.

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). 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?

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. The ABL procedure is executing the batch file as follows:

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:

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. 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.

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.

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?).

Try to see what the PATH value is when invoked from inside the ABL execution context. Try for example:

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

and compare it with what you get from doing "set PATH" from your command line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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