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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
JackStrong
Contributor II
Contributor II

Routine and JSON libraries

Hi Everyone.

 

I have two questions regarding JSON and libraries/imports.

I need to create a routine based on the existing tJavaFlex java code but I can't find out which library should I add to my new routine (by Edit Routine Libraries option).

The logic in tFlexJava is quite complicated so I don't want to choose different library (classes) in my new routine by mistake. 

 

  1. How to find out which library is used when I call below statements in tJavaFlex component (there are no any imports in Advanced settings; no tLibraryLoad component in the job)?

...

JSONArray array = new JSONArray(jsonString);

...

JSONObject object = new JSONObject();

...

 

I even built a job and I checked what are the files in \lib directory but there are a lot of them (~70 files, eg. json-io-4.13.1-TALEND.jar, json-smart-2.4.7.jar,jackson-core-2.13.4.jar,jackson-core-2.13.4.jar,jackson-databind-2.13.4.2.jar).

And to be honest I am not sure if these are all json libraries uses by my talend job.

Especially when I look at the some failures in Talend Studio during execution, eg.

...

routines.system.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]

at routines.system.JSONTokener.syntaxError(JSONObject.java:1819)

at routines.system.JSONObject.<init>(JSONObject.java:166)

at routines.system.JSONObject.<init>(JSONObject.java:308)

...

  

2.Once I know which library should I import to my new routine, is there any better way to force routine to use a particular library than using Edit Routine Libraries option?

 

Without importing I receive error "JSONObject/JSONArray cannot be resolved".

 

Best regards,

Jack Strong

Labels (4)
1 Reply
Anonymous
Not applicable

Hello @Michal Swiniarski​ ,

  1. it will use the system built-in routines.jar while calling the JSONObject statements in tJavaFlex component as the below

0695b00000fKsvFAAS.png 2. The only way to use a particular library for the routine is to use Edit Routine Libraries option

Best regards

Aiming