
Anonymous
Not applicable
2013-02-26
11:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[resolved] tSystem gets CreateProcess error=2
At the end of a job, I need to decode a (long) base64-encoded string into a .zip file.
After several failed approaches, I'm writing it to a .txt file and trying to use tSystem to run an external program to decode it into a target (.zip) file but am getting:
Exception in component tSystem_1
java.io.IOException: Cannot run program "Decode" (in directory "C:\temp"): CreateProcess error=2, The system cannot find the file specified
I've reduced the job to just the tSystem component and moved the decoder program (b64dec.exe) and input .txt file into the c:\temp directory (direct execution there works fine), but the job does not find the program. Anybody see what I'm missing?
After several failed approaches, I'm writing it to a .txt file and trying to use tSystem to run an external program to decode it into a target (.zip) file but am getting:
Exception in component tSystem_1
java.io.IOException: Cannot run program "Decode" (in directory "C:\temp"): CreateProcess error=2, The system cannot find the file specified
I've reduced the job to just the tSystem component and moved the decoder program (b64dec.exe) and input .txt file into the c:\temp directory (direct execution there works fine), but the job does not find the program. Anybody see what I'm missing?
592 Views
1 Solution
Accepted Solutions

Anonymous
Not applicable
2013-02-28
02:22 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Resolved!
YES, I needed to download the commons-codec-1.<7>.jar and install it in my Java Home directory.
Then the job ran but the resulting file was not an intelligible .zip file. Some of the bytes were bad, but most wer good and there was the correct number of them. I guessed the character encoding wasn't supposed to be the UFT-8 per the StringUtils.newStringUtf8() function so I tried a few others from the library and found that StringUtils.newStringIso8859_1() worked.
Voila!
YES, I needed to download the commons-codec-1.<7>.jar and install it in my Java Home directory.
Then the job ran but the resulting file was not an intelligible .zip file. Some of the bytes were bad, but most wer good and there was the correct number of them. I guessed the character encoding wasn't supposed to be the UFT-8 per the StringUtils.newStringUtf8() function so I tried a few others from the library and found that StringUtils.newStringIso8859_1() worked.
Voila!
592 Views
6 Replies

Anonymous
Not applicable
2013-02-26
11:59 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi holberger,
Interesting case
If I had to do that, I wouldn't rely on external tools (such as b64dev.exe).
Indeed, tSystem here isn't the best option : it would make your job not portable anymore, and harder to debug/maintain/fix.
Instead, I'd do the decoding directly in the job. And there are plenty of ways to do that ! But let's look at my favorite one
1. Add a tLibraryLoad in your job. We'll rely on an external library that's called Apache Commons Codec, that provides a very neat way to deal with Base64. It's reliable, and open-source !
2. Add the library named 'commons-codec-1.6.jar'.
3. In the 'Advanced Settings' tab of the tLibrary, add the following two lines in the 'Import' :
(Note : These are the two Java classes needed to convert Base64)
4. In a tMap, use the following snippet to make the transformation :
(here base64.toDecode is the column you have to decode)
5. And then, you can write the decoded data into a file, using a tFileOutputDelimited. There's an option that enables to compress the content as a zip file.
Hope that helps,
Cyril.
Interesting case
If I had to do that, I wouldn't rely on external tools (such as b64dev.exe).
Indeed, tSystem here isn't the best option : it would make your job not portable anymore, and harder to debug/maintain/fix.
Instead, I'd do the decoding directly in the job. And there are plenty of ways to do that ! But let's look at my favorite one
1. Add a tLibraryLoad in your job. We'll rely on an external library that's called Apache Commons Codec, that provides a very neat way to deal with Base64. It's reliable, and open-source !
2. Add the library named 'commons-codec-1.6.jar'.
3. In the 'Advanced Settings' tab of the tLibrary, add the following two lines in the 'Import' :
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.StringUtils;
(Note : These are the two Java classes needed to convert Base64)
4. In a tMap, use the following snippet to make the transformation :
StringUtils.newStringUtf8(Base64.decodeBase64(base64.toDecode));
(here base64.toDecode is the column you have to decode)
5. And then, you can write the decoded data into a file, using a tFileOutputDelimited. There's an option that enables to compress the content as a zip file.
Hope that helps,
Cyril.
592 Views

Anonymous
Not applicable
2013-02-26
03:49 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks so much! This is much better. I'll try it shortly. I was attempting this path earlier but didn't know how to achieve the apache import.
BTW, my input is a 14MB string that originates from a tSoap request.
I strip the XML and miscellaneous characters with a tMap substring expression.
That enters this next, decode part of the process as a tMap single-row and single-column output containing the string. (This is where I'll integrate your method. Maybe I can use the same tMap with a compound expression.)
The decoded output IS the contents of a .zip file.
I plan to use a tFileDelimited to write the decoded, resulting string to a network disk, and Voila!
Since the result is just one row with one column containing a 14MB string, I'm hoping the contents will be written with no changes or additions. Does this sound right?
I'll post the results when I get back to this.
Thanks, again!
BTW, my input is a 14MB string that originates from a tSoap request.
I strip the XML and miscellaneous characters with a tMap substring expression.
That enters this next, decode part of the process as a tMap single-row and single-column output containing the string. (This is where I'll integrate your method. Maybe I can use the same tMap with a compound expression.)
The decoded output IS the contents of a .zip file.
I plan to use a tFileDelimited to write the decoded, resulting string to a network disk, and Voila!
Since the result is just one row with one column containing a 14MB string, I'm hoping the contents will be written with no changes or additions. Does this sound right?
I'll post the results when I get back to this.
Thanks, again!
592 Views

Anonymous
Not applicable
2013-02-27
10:44 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Cyril,
It almost worked.
I configured the tLibraryLoad component as described and used the StringUtils.newStringUtf8(Base64.decodeBase64(String #)) expression in the tMap in a test job that reads the XML-encapsulated string to be decoded. See the first images. For #, I used a substring expression that trims XML stuff from both ends of the encoded string. (It's been tested and is known to work.)
(Ignore the third image. It's from the tSystem attempt and refuses to be deleted.)
It seems the my installation could not find the Apache library. The Run process gets an error in the code building/compilation phase. It warns: Missing jars: commons-codec-1.6.jar. The code shows errors on the import statements. See the latter images.
Do I need to download commons-codec-1.6.jar and install it somewhere? (At the present, MDM, the Jboss server, and MSSqlServer are all running on my computer.
It almost worked.
I configured the tLibraryLoad component as described and used the StringUtils.newStringUtf8(Base64.decodeBase64(String #)) expression in the tMap in a test job that reads the XML-encapsulated string to be decoded. See the first images. For #, I used a substring expression that trims XML stuff from both ends of the encoded string. (It's been tested and is known to work.)
(Ignore the third image. It's from the tSystem attempt and refuses to be deleted.)
It seems the my installation could not find the Apache library. The Run process gets an error in the code building/compilation phase. It warns: Missing jars: commons-codec-1.6.jar. The code shows errors on the import statements. See the latter images.
Do I need to download commons-codec-1.6.jar and install it somewhere? (At the present, MDM, the Jboss server, and MSSqlServer are all running on my computer.
592 Views

Anonymous
Not applicable
2013-02-28
02:22 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Resolved!
YES, I needed to download the commons-codec-1.<7>.jar and install it in my Java Home directory.
Then the job ran but the resulting file was not an intelligible .zip file. Some of the bytes were bad, but most wer good and there was the correct number of them. I guessed the character encoding wasn't supposed to be the UFT-8 per the StringUtils.newStringUtf8() function so I tried a few others from the library and found that StringUtils.newStringIso8859_1() worked.
Voila!
YES, I needed to download the commons-codec-1.<7>.jar and install it in my Java Home directory.
Then the job ran but the resulting file was not an intelligible .zip file. Some of the bytes were bad, but most wer good and there was the correct number of them. I guessed the character encoding wasn't supposed to be the UFT-8 per the StringUtils.newStringUtf8() function so I tried a few others from the library and found that StringUtils.newStringIso8859_1() worked.
Voila!
593 Views

Anonymous
Not applicable
2013-03-01
03:28 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great holberger ! Sorry for the late reply, but glad to see that this trick worked for your case !
Have fun with Talend
Have fun with Talend
592 Views

Anonymous
Not applicable
2014-06-04
06:31 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I receive the same error message but it seems unrelated to the command the component is trying to run. The tSystem component fails even attempting commands like echo or cd. Obviously these commands work if I execute them in a command line manually and it doesn't seem like it could be a problem in the job itself since the command is so simple. I figure it must be some kind of problem with my java environment but I've tried with multiple installations (1.6,1.7 and 1.8) and I haven't had any luck. Could you help me narrow down the source of this problem?
Starting job j_UT_ELAVON_BATCHES_FUNDED_DMART at 17:22 04/06/2014.
connecting to socket on port 3850
connected
Files are identical
Exception in component tSystem_1
java.io.IOException: Cannot run program "echo": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at pdwserver.j_ut_elavon_batches_funded_dmart_0_1.j_UT_ELAVON_BATCHES_FUNDED_DMART.tSystem_1Process(j_UT_ELAVON_BATCHES_FUNDED_DMART.java:5936)
at pdwserver.j_ut_elavon_batches_funded_dmart_0_1.j_UT_ELAVON_BATCHES_FUNDED_DMART.tFileCompare_1Process(j_UT_ELAVON_BATCHES_FUNDED_DMART.java:5848)
at pdwserver.j_ut_elavon_batches_funded_dmart_0_1.j_UT_ELAVON_BATCHES_FUNDED_DMART.tFileCopy_1Process(j_UT_ELAVON_BATCHES_FUNDED_DMART.java:5338)
at pdwserver.j_ut_elavon_batches_funded_dmart_0_1.j_UT_ELAVON_BATCHES_FUNDED_DMART.tOracleInput_1Process(j_UT_ELAVON_BATCHES_FUNDED_DMART.java:4749)
at pdwserver.j_ut_elavon_batches_funded_dmart_0_1.j_UT_ELAVON_BATCHES_FUNDED_DMART.runJobInTOS(j_UT_ELAVON_BATCHES_FUNDED_DMART.java:6848)
at pdwserver.j_ut_elavon_batches_funded_dmart_0_1.j_UT_ELAVON_BATCHES_FUNDED_DMART.main(j_UT_ELAVON_BATCHES_FUNDED_DMART.java:6667)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 10 more
disconnected
Job j_UT_ELAVON_BATCHES_FUNDED_DMART ended at 17:22 04/06/2014.
Starting job j_UT_ELAVON_BATCHES_FUNDED_DMART at 17:22 04/06/2014.
connecting to socket on port 3850
connected
Files are identical
Exception in component tSystem_1
java.io.IOException: Cannot run program "echo": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at pdwserver.j_ut_elavon_batches_funded_dmart_0_1.j_UT_ELAVON_BATCHES_FUNDED_DMART.tSystem_1Process(j_UT_ELAVON_BATCHES_FUNDED_DMART.java:5936)
at pdwserver.j_ut_elavon_batches_funded_dmart_0_1.j_UT_ELAVON_BATCHES_FUNDED_DMART.tFileCompare_1Process(j_UT_ELAVON_BATCHES_FUNDED_DMART.java:5848)
at pdwserver.j_ut_elavon_batches_funded_dmart_0_1.j_UT_ELAVON_BATCHES_FUNDED_DMART.tFileCopy_1Process(j_UT_ELAVON_BATCHES_FUNDED_DMART.java:5338)
at pdwserver.j_ut_elavon_batches_funded_dmart_0_1.j_UT_ELAVON_BATCHES_FUNDED_DMART.tOracleInput_1Process(j_UT_ELAVON_BATCHES_FUNDED_DMART.java:4749)
at pdwserver.j_ut_elavon_batches_funded_dmart_0_1.j_UT_ELAVON_BATCHES_FUNDED_DMART.runJobInTOS(j_UT_ELAVON_BATCHES_FUNDED_DMART.java:6848)
at pdwserver.j_ut_elavon_batches_funded_dmart_0_1.j_UT_ELAVON_BATCHES_FUNDED_DMART.main(j_UT_ELAVON_BATCHES_FUNDED_DMART.java:6667)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 10 more
disconnected
Job j_UT_ELAVON_BATCHES_FUNDED_DMART ended at 17:22 04/06/2014.
592 Views
