Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Experts,
I am very new to Talend.
I am getting the below error while executing a talend job which transfers data from oracle database to json.
the intial design was,
tdbinput ---> tmap ---> twritejsonfields
since I got int to String type mismatch error, I have introduced tjava component and converted the column to string.
The job execution is failing now with the below error.
Please help me in resolving.
Starting job JOB_PT_ORA_TO_JSON_LOCATION_INFO at 11:00 06/06/2019.
[statistics] connecting to socket on port 3883
[statistics] connected
Exception in component tJava_1 (JOB_PT_ORA_TO_JSON_LOCATION_INFO)
java.lang.NullPointerException
at etl_poc_v2.job_pt_ora_to_json_location_info_0_1.JOB_PT_ORA_TO_JSON_LOCATION_INFO.tDBInput_2Process(JOB_PT_ORA_TO_JSON_LOCATION_INFO.java:3046)
at etl_poc_v2.job_pt_ora_to_json_location_info_0_1.JOB_PT_ORA_TO_JSON_LOCATION_INFO.runJobInTOS(JOB_PT_ORA_TO_JSON_LOCATION_INFO.java:6606)
at etl_poc_v2.job_pt_ora_to_json_location_info_0_1.JOB_PT_ORA_TO_JSON_LOCATION_INFO.main(JOB_PT_ORA_TO_JSON_LOCATION_INFO.java:6432)
[FATAL]: etl_poc_v2.job_pt_ora_to_json_location_info_0_1.JOB_PT_ORA_TO_JSON_LOCATION_INFO - tJava_1 null
java.lang.NullPointerException
at etl_poc_v2.job_pt_ora_to_json_location_info_0_1.JOB_PT_ORA_TO_JSON_LOCATION_INFO.tDBInput_2Process(JOB_PT_ORA_TO_JSON_LOCATION_INFO.java:3046)
at etl_poc_v2.job_pt_ora_to_json_location_info_0_1.JOB_PT_ORA_TO_JSON_LOCATION_INFO.runJobInTOS(JOB_PT_ORA_TO_JSON_LOCATION_INFO.java:6606)
at etl_poc_v2.job_pt_ora_to_json_location_info_0_1.JOB_PT_ORA_TO_JSON_LOCATION_INFO.main(JOB_PT_ORA_TO_JSON_LOCATION_INFO.java:6432)
[statistics] disconnected
Job JOB_PT_ORA_TO_JSON_LOCATION_INFO ended at 11:00 06/06/2019. [exit code=1]
Thanks in Advance!
Best Regards,
Priya
Default values are not supported in tMap in 6.2 it looks like:
https://help.talend.com/reader/I5~nujSNXadpT4WYWRHrjw/NnnMrtkRENP9mpQw6MrDHA
They may be supported now, I am not sure. You could test it by using a default like "x" for a String field.
You could also try quoting the default value for your BigDecimal, like "1".
You can implement your default values in the row expression:
row1.AVP_STANDARD_ALGORITHM != null ? row1.AVP_STANDARD_ALGORITHM : new BigDecimal("1")
Are you new to Java? If not, you can debug this kind of error by looking at the 'Code' tab and finding the line with the red error. You can inspect the generated Java code there.
You should really use a tJavaRow here. Either way, both tJava and tJavaRow do not pass the variables onto the next component. So all values will be null at your tWriteJSONField component.
I am not sure where or why you got an int to String type mismatch error. You don't need a Java component there, you can do the conversion of the BigDecimal to a String in your tMap. In the AVP_STANDARD_ALGORITHM column in out_map, make it a String type and put row1.AVP_STANDARD_ALGORITHM.toString() as the expression. Propagate the type change down the line.
Also, the code in your tJava does nothing. You are not assigning the result to a variable. It does not convert inline like that.
@nfz11 thanks a ton for your reply. I have modified my job. I have removed the tjava component. I am getting type mismatch int to string converstion error after mapping tmap --> tjsonwritefield.
row1.AVP_STANDARD_ALGORITHM.toString() -> is also not converting in tmap.
please help me in resolving the issue.
Error in the component's properties:Type mismatch: cannot convert from int to String
The method put(String, String) in the type Map<String,String> is not applicable for the arguments (String, ((tjsonout.MANIPULATE_EVENTS != null) ? tjsonout.MANIPULATE_EVENTS.toPlainString() : 0))
Type mismatch: cannot convert from int to String
The method put(String, String) in the type Map<String,String> is not applicable for the arguments (String, ((tjsonout.MANUALLY_INSERTED_PARTS != null) ? tjsonout.MANUALLY_INSERTED_PARTS.toPlainString() : 0))
Type mismatch: cannot convert from int to String
The method put(String, String) in the type Map<String,String> is not applicable for the arguments (String, ((tjsonout.AVP_STANDARD_ALGORITHM != null) ? tjsonout.AVP_STANDARD_ALGORITHM.toPlainString() : 1))
Type mismatch: cannot convert from int to String
The method put(String, String) in the type Map<String,String> is not applicable for the arguments (String, ((tjsonout.DISABLED != null) ? tjsonout.DISABLED.toPlainString() : 0))
Best Regards,
Priya
here is my tmap screenshot with toString(). the direct mapping without any conversion is running fine if I directly load the data to Database. I am getting conversion error only when mapping to tjsonwritefileld component.
Please let me know your comments.
Best Regards,
Priya
You need to change the type to String for those columns such as AVP_STANDARD_ALGORITHM in the schema editor of out_tmap in the lower right of the map editor. Right now they are still BigDecimal.
@nfz11 yes I tried changing the output column also as String. Eventhough it is failing with same error.
I suspect something needs to be changed in TJSONWRITEFILED component. please let me know whether I should create as attribute for bigdecimal datatype columns. here I have created as add subelement like we keep for String.
Best Regards,
Priya
@nfz11 as you suggested I tried adding column by column and checked, I faced issues in 4 columns which has some default values in tmap. if I remove the default value for the columns it is working fine.
what needs to be done if we should to keep default values also and run without facing int to string error.
Best Regards,
Priya
Default values are not supported in tMap in 6.2 it looks like:
https://help.talend.com/reader/I5~nujSNXadpT4WYWRHrjw/NnnMrtkRENP9mpQw6MrDHA
They may be supported now, I am not sure. You could test it by using a default like "x" for a String field.
You could also try quoting the default value for your BigDecimal, like "1".
You can implement your default values in the row expression:
row1.AVP_STANDARD_ALGORITHM != null ? row1.AVP_STANDARD_ALGORITHM : new BigDecimal("1")