Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

[resolved] Problems using StringUtils.isNotBlank

I am having issues using StringUtils.isNotBlank in a map. When running the job I receive the error

'The method isNotBlank(String) is undefined for the type StringUtils'

I have tried different ways of loading in tLibraryLoad
import org.apache.commons.lang.StringUtils;
import static org.apache.commons.lang.StringUtils.*;
import static org.apache.commons.lang.StringUtils.isNotBlank;

I am loading commons-lang-2.6.jar

In the map where I am trying to use the method I specify

StringUtils.isNotBlank(row8.FieldValue)

I am new to Java so I maybe missing something obvious, any ideas?

Do I need to worry about the CLASSPATH?
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

It is often a matter in which order the libraries will be loaded. apache commons library is very often a part of an component and if you depends on a newer version and load your library than you have to take care that this library classes are not already loaded. Classes will be loaded only once per Java start (Talend does not use special class loaders, only the standard class loader) and classes will not be updated due a further load of a library.
I suggest: extract the methods you need and implement them in a routines and you have always the access to your code.

View solution in original post

2 Replies
_AnonymousUser
Specialist III
Specialist III
Author

Feedback.
.
I got this to work, unfortunately I am not sure what made it work. I was getting really frustrated with this so I was trying everything I could think of. I moved the .JAR to the Talend directory, I created a function to load the library and then removed it. I exited and re-opened Talend (I think this is what solved it). Anyway it is now working, I will try and prove this out when I have more time. But basically what I have now is

I used tLibraryLoad in my job with
import org.apache.commons.lang.StringUtils;


Regards,
Derek
Anonymous
Not applicable

It is often a matter in which order the libraries will be loaded. apache commons library is very often a part of an component and if you depends on a newer version and load your library than you have to take care that this library classes are not already loaded. Classes will be loaded only once per Java start (Talend does not use special class loaders, only the standard class loader) and classes will not be updated due a further load of a library.
I suggest: extract the methods you need and implement them in a routines and you have always the access to your code.