tHDFSPut/tHDFSOutput - java.lang.NullPointerException

One Star

tHDFSPut/tHDFSOutput - java.lang.NullPointerException

When using tHDFSPut or tHDFSOutput I keep ending with error: 'java.lang.NullPointerException'. The flow works fine until I add tHDFSPut of tHDFSOutput to the flow. Does anybody know a solution for this error?
Seventeen Stars

Re: tHDFSPut/tHDFSOutput - java.lang.NullPointerException

Select the component tHDFSPut in your job and change to the code view and post the lines around the line mentioned in your stack trace from the NullPointerException. This way we can try to find the reason.
One Star

Re: tHDFSPut/tHDFSOutput - java.lang.NullPointerException

Hi, thanks for the response!
Below the code belonging to the tSDHFPut.
I have no clue why the error always pops up after adding tHFFSPUT or tHDFSOutput.
currentComponent = "tHDFSPut_1";
// row7
// row7
if (execStat) {
runStat.updateStatOnConnection("row7" + iterateId,
1, 1);
}
java.util.Set<String> keySet_tHDFSPut_1 = map_tHDFSPut_1
.keySet();
for (String key_tHDFSPut_1 : keySet_tHDFSPut_1) {
String tempdir_tHDFSPut_1 = localdir_tHDFSPut_1;
String filemask_tHDFSPut_1 = key_tHDFSPut_1;
String dir_tHDFSPut_1 = null;
String mask_tHDFSPut_1 = filemask_tHDFSPut_1
.replaceAll("\\\\", "/");
int i_tHDFSPut_1 = mask_tHDFSPut_1.lastIndexOf('/');
if (i_tHDFSPut_1 != -1) {
dir_tHDFSPut_1 = mask_tHDFSPut_1.substring(0,
i_tHDFSPut_1);
mask_tHDFSPut_1 = mask_tHDFSPut_1
.substring(i_tHDFSPut_1 + 1);
}
if (dir_tHDFSPut_1 != null
&& !"".equals(dir_tHDFSPut_1))
tempdir_tHDFSPut_1 = tempdir_tHDFSPut_1 + "/"
+ dir_tHDFSPut_1;
mask_tHDFSPut_1 = mask_tHDFSPut_1.replaceAll("\\.",
"\\\\.").replaceAll("\\*", ".*");
final String finalMask_tHDFSPut_1 = mask_tHDFSPut_1;
java.io.File[] listings_tHDFSPut_1 = null;
java.io.File file_tHDFSPut_1 = new java.io.File(
tempdir_tHDFSPut_1);
if (file_tHDFSPut_1.isDirectory()) {
listings_tHDFSPut_1 = file_tHDFSPut_1
.listFiles(new java.io.FileFilter() {
public boolean accept(
java.io.File pathname) {
boolean result = false;
if (pathname != null
&& pathname.isFile()) {
result = java.util.regex.Pattern
.compile(
finalMask_tHDFSPut_1)
.matcher(
pathname.getName())
.find();
}
return result;
}
});
}
if (listings_tHDFSPut_1 == null
|| listings_tHDFSPut_1.length <= 0) {
System.err.println("No match file("
+ key_tHDFSPut_1 + ") exist!");
} else {
String localFilePath_tHDFSPut_1 = "";
String hdfsFilePath_tHDFSPut_1 = "";
for (int m_tHDFSPut_1 = 0; m_tHDFSPut_1 < listings_tHDFSPut_1.length; m_tHDFSPut_1++) {
if (listings_tHDFSPut_1
.getName().matches(mask_tHDFSPut_1)) {
localFilePath_tHDFSPut_1 = listings_tHDFSPut_1
.getAbsolutePath();
hdfsFilePath_tHDFSPut_1 = "/user/sandbox"
+ "/"
+ map_tHDFSPut_1
.get(key_tHDFSPut_1);
try {
fs_tHDFSPut_1
.copyFromLocalFile(
false,
true,
new org.apache.hadoop.fs.Path(
localFilePath_tHDFSPut_1),
new org.apache.hadoop.fs.Path(
hdfsFilePath_tHDFSPut_1));
// add info to list will return
msg_tHDFSPut_1
.add("file: "
+ listings_tHDFSPut_1
.getAbsolutePath()
+ ", size: "
+ listings_tHDFSPut_1
.length()
+ " bytes upload successfully");
nb_success_tHDFSPut_1++;
} catch (java.io.IOException e) {
throw (e);
}
nb_file_tHDFSPut_1++;
}
}
}
}
tos_count_tHDFSPut_1++;
/**
* stop
*/
/**
One Star

Re: tHDFSPut/tHDFSOutput - java.lang.NullPointerException

I started having this error after I install componet hadoop patch to resolve the winutils.exe error.  Remove the component but issue still persist.
Moderator

Re: tHDFSPut/tHDFSOutput - java.lang.NullPointerException

Hi tribui333,
Could you please indicate the build version you aere using? What's your current workflow?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.