AEM Junit java.lang.NoSuchMethodError: 'boolean org.apache.commons.lang3.StringUtils.isNoneBlank(java.lang.CharSequence[])' | Community
Skip to main content
archana_r
Level 2
February 27, 2024
Solved

AEM Junit java.lang.NoSuchMethodError: 'boolean org.apache.commons.lang3.StringUtils.isNoneBlank(java.lang.CharSequence[])'

  • February 27, 2024
  • 1 reply
  • 2697 views

Hi All, 

 

I am getting this error for Stringutils method while debugging junit. Am i missing anything?

 

ava.lang.NoSuchMethodError: 'boolean org.apache.commons.lang3.StringUtils.isNoneBlank(java.lang.CharSequence[])'

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

As mentioned by @imran__khan , you might not be using the correct java api.

 

you can use the StringUtils.isNotBlank method, which is available with all the apis

https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isNotBlank-java.lang.CharSequence-

1 reply

Imran Khan
Community Advisor
Community Advisor
February 27, 2024

@archana_r This line is written as part of which file, test class or the class for which we are writing junit.

 

Here's your problem: commons-lang-2.6.jar doesn't contain the org.apache.commons.lang3 package, since that's part of version 3, and commons-lang3-3.1-sources.jar contains the source code, not the byte code.

You need to include commons-lang3-3.1.jar instead.


Refer below link for more info
https://stackoverflow.com/questions/28504174/noclassdeffounderror-org-apache-commons-lang3-stringutils

archana_r
archana_rAuthor
Level 2
February 27, 2024

I am invoking an util class from my test class. The util class has this

StringUtils.isNoneBlank(path)method.

Is there anything, we need add in Junit test class while invkoing?

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
February 27, 2024

As mentioned by @imran__khan , you might not be using the correct java api.

 

you can use the StringUtils.isNotBlank method, which is available with all the apis

https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isNotBlank-java.lang.CharSequence-

Arun Patidar