Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
TomG1
Creator
Creator

globalMap.get() is not working

I am using a global map variable in a tJavaRow component. but its giving an error message.

"cannot make a static reference to the non-static field".

I am using BigData Spark job.

How Do i overcome this issue.

 

0683p000009LuqS.jpg

Labels (4)
11 Replies
cterenzi
Specialist
Specialist

Can you show your component code instead of the Code tab?
TomG1
Creator
Creator
Author

I have created a simple mapping to show this error.

 

0683p000009LuQl.png

 

 

the error is coming from the tJavaRow component which i have shown in the first post.

 

here is the code of the tjavarow component .

 

 String[] values = (String[])globalMap.get("values");
 
 row1.a = row2.a;
 row1.b = row2.b;

here is the code in tjava component

String[] values = { "This", "is", "test" };

globalMap.put("values", values);

 

try reproducing the error in you system.

 

request to help me on this..

 

 

Anonymous
Not applicable

@tomaszc, I tried the way you explained. For me it is working fine, i was able to get the values from globalMap in the tJavaRow.

I've exported my job (Test.zip), you can download it and have a look.

 

Hope this helps.

TomG1
Creator
Creator
Author

Hi,

I am not able to open your job in talend.

 

what kind of job is that.. is it standard or bigdata job?.

 

I am specifically talking about Bigdata Spark job.

 

In Talend standard job , I am able to get the output . but the same code in talend big data is giving error.

 

I am using 'Talend big data plaform 6.2'

 

Thanks

Anonymous
Not applicable

Sorry it was a standard job, not a Bigdata Spark job. I will give it a try with Bigdata Spark job.

TomG1
Creator
Creator
Author

I am trying with an alternative

 

I have created a context variable of type Object.

 

0683p000009Lurp.jpg

To this variable I am saving my string array  in tJava component

String[] cols = { "This","is","test" };
context.SrcCols = cols;

I am accessing this context variable in tJavarow

String[] Cols = (String[])context.SrcCols;

but while running its giving the following error.

java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.String;

 

 

 

 

Anil3
Contributor
Contributor

Hello Tom,

Did you get any solution to make it work in BigData Spark Job? we tried to implement the same and found this artilce with the same error what we are getting.

Please suggest.

 

Anonymous
Not applicable

Hello,

 

Currently, there is no access for "globalMap" in Spark Batch mode. This is due to a different implementation of Spark Batch compared to DI. You will only be able to accomplish this with standard DI jobs.

TomG1
Creator
Creator
Author

This feature is not available in talend spark jobs.

We have raised a ticket to talend support and they mentioned that it is a limitation in talend big data job.

I don't know if this feature is available in talend latest version

 

Thanks