CriticalError when calling javaAction Random Strong Password

2
When calling the javaAction Random Strong Password, the app crashes with stacktrace (see below). It is caused by an error in the communitycommons.StringUtils. In Line 313: String totalChars = RandomStringUtils.randomAlphanumeric(minLen - fixedNumber, maxLen - fixedNumber); Strange thing is, that apaches RandomStringUtils offer both methods: https://commons.apache.org/proper/commons-lang/javadocs/api-3.9/org/apache/commons/lang3/RandomStringUtils.html Any hint how to circumvent this? java.lang.NoSuchMethodError: org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric(II)Ljava/lang/String;     at communitycommons.StringUtils.generateCommonLangPassword(StringUtils.java:313)     at communitycommons.StringUtils.randomStrongPassword(StringUtils.java:303)     at communitycommons.actions.RandomStrongPassword.executeAction(RandomStrongPassword.java:43)     at communitycommons.actions.RandomStrongPassword.executeAction(RandomStrongPassword.java:21)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:49)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54)     at com.mendix.basis.actionmanagement.ActionManagerBase$1.execute(ActionManagerBase.java:147)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32)     at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:152)     at com.mendix.basis.component.InternalCoreBase.execute(InternalCoreBase.java:382)     at com.mendix.modules.microflowengine.actions.actioncall.JavaAction.execute(JavaAction.scala:53)
asked
5 answers
7

Just tested this in a clean project Mx version 8.0.0 and can’t reproduce the error that you are receiving.

Can it be that you have a jar conflict, maybe multiple versions of lang3 in your userlib directory? Or missing some jar file, maybe download the commons module fresh and overwrite the current version?

[Edit]

Just had the same issue with a coworker and the issue is the new version of the randomStringUtils method now only has 1 argument, just the amount and no longer the min and max. When using a newer version of the jar file replace the code to just use 1 number. For a comlpete solution make sure the java action only takes 1 argument as well, the number of characters only and make sure this is propagated correctly in the different methods associated with this function. To get this fixed correctly I suggest opening an issue on github to have the jar version upgraded for the commons module.

answered
4

Hi There,

I ran into the same issue with Mendix 7.23.11.

In case someone else still in need of a solution,

this is cause by jar files in conflict with each other. And this error will never happen when you create a new project as Erwin tried to reproduce the error.

Erwin to reproduce:

  1. create a new project
  2. install community commons Functions Library from the App store,
  3. install StringUtils from the App store (with is already include in the Community Commons). What happens is the StringUtils will come with a set of libraries(old) and override/add on the existing ones.

 

To solve this, go in the userlib, and look for all the libraries with lang3, as below:

  • commons.lang3…
  • and also org.apache.commons.lang3…

 

remove all of them and keep the most recent one. I recommend to keep the most recent of type commons.lang3.

Hope this will help.

answered
0

Hi Max

I had the same problem. I solved it by downgrading the commons to previows version in the app store.

answered
0

Community Commons version 8.1.0 doesn't have this problem. All versions above do.

answered
0

Downgrading to version 8.3.1. of Community Commons worked for me.

answered