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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
param75
Contributor III
Contributor III

[resolved] Undefined function and use tLibraryLoad

Hello,
I need to use the library "commons-lang3" and more specically the function "unescapeHtml4".
So I use a tLibraryLoad and a tjava. In the tjava I just have "System.out.println(unescapeHtml4("<Français>"));"
But I have the message error : "La méthode unescapeHtml4(String) est indéfinie pour le type test_library"

So I've tried with another method : I use the "User Libraries Preferences". I add the .jar in this window
I use just a tjava with :
String test = "<Français>";
System.out.println(org.apache.commons.lang3.StringEscapeUtils.unescapeHtml3(test));
But I have the message error :
connecting to socket on port 3463
connected
Exception in thread "main" java.lang.Error: java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringEscapeUtils
at sis.test_library_0_1.test_library.tJava_1Process(test_library.java:1313)
at sis.test_library_0_1.test_library.runJobInTOS(test_library.java:1506)
at sis.test_library_0_1.test_library.main(test_library.java:1359)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringEscapeUtils
at sis.test_library_0_1.test_library.tJava_1Process(test_library.java:1275)
... 2 more
disconnected
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang3.StringEscapeUtils
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 3 more


How can I use an external library ?

(I've take the library "commons-lang3-3.1-bin.zip" on this website http://commons.apache.org/lang/download_lang.cgi)
Thank you,
Carole
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi
You should import the class before using it, go to the advanced setting tab of tJava:
import org.apache.commons.lang3.StringEscapeUtils.unescapeHtml4;

or use the class with full package path:
System.out.println(org.apache.commons.lang3.StringEscapeUtils.unescapeHtml4("<Français>"));

View solution in original post

2 Replies
Anonymous
Not applicable

Hi
You should import the class before using it, go to the advanced setting tab of tJava:
import org.apache.commons.lang3.StringEscapeUtils.unescapeHtml4;

or use the class with full package path:
System.out.println(org.apache.commons.lang3.StringEscapeUtils.unescapeHtml4("<Français>"));
param75
Contributor III
Contributor III
Author

Thank you !
It's work well with the second method ! 🙂