
Specialist III
2014-08-26
10:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[resolved] tBufferOutput:java.util.HashMap cannot be cast to java.lang.String
Hi All,
I have two jobs called parent and child job.parent job will call child job and child job will return some result to parent job.
Parent and child jobs will look like below :
tjava :
tFixedFlowInput schema :
tBufferOutput schema :
Child job :
Parent job :
tRunJob Schema:
tJavaRow will looks like below :
But when I execute the parent job I'm getting an exception like tBufferOutput:java.util.HashMap cannot be cast to java.lang.String.Am I doing something wrong? Is there any other alternative way to return childjob result to the parent job?
Can any one please advice me on this.
Thanks in advance,
Sayagoud Ravelly
I have two jobs called parent and child job.parent job will call child job and child job will return some result to parent job.
Parent and child jobs will look like below :
tjava :
tFixedFlowInput schema :
Child job :
Parent job :
tRunJob Schema:
tJavaRow will looks like below :
But when I execute the parent job I'm getting an exception like tBufferOutput:java.util.HashMap cannot be cast to java.lang.String.Am I doing something wrong? Is there any other alternative way to return childjob result to the parent job?
Can any one please advice me on this.
Thanks in advance,
Sayagoud Ravelly
899 Views
1 Solution
Accepted Solutions

Specialist III
2014-09-11
04:22 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I resolved this issue in following way :
Parent job :we need to define a ConcurrentHashMap in parent job
globalMap.put("sharedMap", new java.util.concurrent.ConcurrentHashMap());
Child job : Define a context variable of type object here for ex:sharedMap
((java.util.Map)context.sharedMap).put("test", "test123");
((java.util.Map)context.sharedMap).put("hello","hello123");
Configure tRunjob in parent job like below :
Retrieve the values in Parent job like below:
System.out.println("test>>"+((java.util.Map)globalMap.get("sharedMap")).get("test"));
System.out.println("hello>>"+((java.util.Map)globalMap.get("sharedMap")).get("hello"));
output :
I resolved this issue in following way :
Parent job :we need to define a ConcurrentHashMap in parent job
globalMap.put("sharedMap", new java.util.concurrent.ConcurrentHashMap());
Child job : Define a context variable of type object here for ex:sharedMap
((java.util.Map)context.sharedMap).put("test", "test123");
((java.util.Map)context.sharedMap).put("hello","hello123");
Configure tRunjob in parent job like below :
Retrieve the values in Parent job like below:
System.out.println("test>>"+((java.util.Map)globalMap.get("sharedMap")).get("test"));
System.out.println("hello>>"+((java.util.Map)globalMap.get("sharedMap")).get("hello"));
output :
899 Views
7 Replies

Anonymous
Not applicable
2014-08-26
06:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have misunderstood the Talend type List. List means a couple of Strings which can be selected in a combobox (e.g. for a prompt). Use the Talend type Object.
899 Views

Specialist III
2014-08-27
02:56 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have misunderstood the Talend type List. List means a couple of Strings which can be selected in a combobox (e.g. for a prompt). Use the Talend type Object.
Hi jlolling,
Thanks for your reply.I have tried the way you suggested but got a similar exception like below in parent job.
899 Views

Anonymous
Not applicable
2014-08-27
06:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have to change the type for the context variable in both jobs (parent and child).
899 Views

Specialist III
2014-08-27
11:06 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have to change the type for the context variable in both jobs (parent and child).
Hi jlolling,
I configured the context variable in child job as of type Object.
But in Parent job I'm using input_row.ListObject directly from the trunjob flow like below.
List<HashMap<String,HashMap<String, String>>> childjob_list = (List<HashMap<String,HashMap<String, String>>>)input_row.ListObject;
And also tried by defining the same context in parent job like below but no luck,getting same exception.
List<HashMap<String,HashMap<String, String>>> childjob_list = (List<HashMap<String,HashMap<String, String>>>)input_row.ListObject;
899 Views

Specialist III
2014-09-11
04:22 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I resolved this issue in following way :
Parent job :we need to define a ConcurrentHashMap in parent job
globalMap.put("sharedMap", new java.util.concurrent.ConcurrentHashMap());
Child job : Define a context variable of type object here for ex:sharedMap
((java.util.Map)context.sharedMap).put("test", "test123");
((java.util.Map)context.sharedMap).put("hello","hello123");
Configure tRunjob in parent job like below :
Retrieve the values in Parent job like below:
System.out.println("test>>"+((java.util.Map)globalMap.get("sharedMap")).get("test"));
System.out.println("hello>>"+((java.util.Map)globalMap.get("sharedMap")).get("hello"));
output :
I resolved this issue in following way :
Parent job :we need to define a ConcurrentHashMap in parent job
globalMap.put("sharedMap", new java.util.concurrent.ConcurrentHashMap());
Child job : Define a context variable of type object here for ex:sharedMap
((java.util.Map)context.sharedMap).put("test", "test123");
((java.util.Map)context.sharedMap).put("hello","hello123");
Configure tRunjob in parent job like below :
Retrieve the values in Parent job like below:
System.out.println("test>>"+((java.util.Map)globalMap.get("sharedMap")).get("test"));
System.out.println("hello>>"+((java.util.Map)globalMap.get("sharedMap")).get("hello"));
output :
900 Views

Anonymous
Not applicable
2016-09-14
03:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Attempting to follow this recipe to draw out the context titled "Failed_Dir" from the sub-job.
I put in "sharedMap" as a context variable with the type as Object.
tjava2 --> tRunJob1 --> tJava3
1) tJava2 - globalMap.put("sharedMap", new java.util.concurrent.ConcurrentHashMap());
2a) tRunJob1 - Setting as sharedMap and Value: (java.util.Map)globalMap.get("sharedMap")
2b) tjava 1 inside the Child Job - ((java.util.Map) context.sharedMap).put("Failed_Dir", context.Failed_Dir);
3) tjava3 - System.out.println("Failed_Dir=" + ((String) ((java.util.Map) globalMap.get("sharedMap")).get("Failed_Dir")));
What I'm getting is:
connecting to socket on port 3485
connected
Exception in component tJava_3
java.lang.NullPointerException
at spv.jo_spv_0010_ingestpolicyenginedata_02_new_0_2.jo_SPV_0010_IngestPolicyEngineData_02_NEW.tJava_2Process(jo_SPV_0010_IngestPolicyEngineData_02_NEW.java:3218)
at spv.jo_spv_0010_ingestpolicyenginedata_02_new_0_2.jo_SPV_0010_IngestPolicyEngineData_02_NEW.runJobInTOS(jo_SPV_0010_IngestPolicyEngineData_02_NEW.java:4549)
at spv.jo_spv_0010_ingestpolicyenginedata_02_new_0_2.jo_SPV_0010_IngestPolicyEngineData_02_NEW.main(jo_SPV_0010_IngestPolicyEngineData_02_NEW.java:3791)
disconnected
Job jo_SPV_0010_IngestPolicyEngineData_02_NEW ended at 17:29 14/09/2016.
Can anybody help?
I put in "sharedMap" as a context variable with the type as Object.
tjava2 --> tRunJob1 --> tJava3
1) tJava2 - globalMap.put("sharedMap", new java.util.concurrent.ConcurrentHashMap());
2a) tRunJob1 - Setting as sharedMap and Value: (java.util.Map)globalMap.get("sharedMap")
2b) tjava 1 inside the Child Job - ((java.util.Map) context.sharedMap).put("Failed_Dir", context.Failed_Dir);
3) tjava3 - System.out.println("Failed_Dir=" + ((String) ((java.util.Map) globalMap.get("sharedMap")).get("Failed_Dir")));
What I'm getting is:
connecting to socket on port 3485
connected
Exception in component tJava_3
java.lang.NullPointerException
at spv.jo_spv_0010_ingestpolicyenginedata_02_new_0_2.jo_SPV_0010_IngestPolicyEngineData_02_NEW.tJava_2Process(jo_SPV_0010_IngestPolicyEngineData_02_NEW.java:3218)
at spv.jo_spv_0010_ingestpolicyenginedata_02_new_0_2.jo_SPV_0010_IngestPolicyEngineData_02_NEW.runJobInTOS(jo_SPV_0010_IngestPolicyEngineData_02_NEW.java:4549)
at spv.jo_spv_0010_ingestpolicyenginedata_02_new_0_2.jo_SPV_0010_IngestPolicyEngineData_02_NEW.main(jo_SPV_0010_IngestPolicyEngineData_02_NEW.java:3791)
disconnected
Job jo_SPV_0010_IngestPolicyEngineData_02_NEW ended at 17:29 14/09/2016.
Can anybody help?
899 Views

Anonymous
Not applicable
2016-09-19
10:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just bumping this up so if anyone has any ideas?
Or should I put this as a new topic?
Or should I put this as a new topic?
899 Views
