Application is build successfully by gradle and genearate EAR file. But after deploying to JBOSS EAP 7.4, exception is throwing as below:

ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /demo/: java.lang.NoSuchMethodError: org.apache.commons.collections.CollectionUtils.isEmpty(Ljava/util/Collection;)Z

Dependency: implementation ('commons-collections:commons-collections:3.2.2')

Jboss: C:\jboss-eap-7.4\modules\system\layers\base\org\apache\commons\collections\main

enter image description here

module.xml:

    <module name="org.apache.commons.collections" xmlns="urn:jboss:module:1.9">

    <properties>
        <property name="jboss.api" value="private"/>
    </properties>

    <resources>
        <resource-root path="commons-collections-3.2.2.redhat-2.jar"/>
    </resources>

    <dependencies>
        <module name="java.desktop"/>
    </dependencies>
</module>
1

There are 1 best solutions below

0
Elias On

Hit ctrl+shift+T and will see all the jar's who are all having this CollectionUtils class.

Below are the dependencies having same class but one of them have no isEmpty method in it.

implementation ('commons-collections:commons-collections:3.2.2')
com.google.gwt:gwt-dev:2.4.0

In my case only one place I am using this code, hence removing CollectionUtils.isEmpty(list) instead I am using list.isEmpty() and I am able to resolve this issue. Big Thanks to my friend Manikantha who help me on this issue.