Unable to locate ListOrderedMap?

664 Views Asked by At

I have included all the 6 jars (beanutils, lang, logging, collections, ezmorph, json-lib). Its working fine in simple struts application. But in my struts application, although I have included all jar files, its shows a NoClassDefFoundError about ListOrderedMap.

I don't know how to make my app know that class. But I have included like other required jars for different functionality.

Please help me to resolve this issue.

2

There are 2 best solutions below

0
On

Yes, even tho there is NOW a newer v4.x for commons-collections, the 4.x do NOT work!

So, get the older highest version from v3.x, namely: v3.2.1

If you're using maven, like I am, here's my complete working dependencies list:

  <dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<!-- <classifier>jdk15</classifier> -->
  </dependency>

  <dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
  </dependency>

  <dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
   </dependency>

   <dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.1</version>
   </dependency>

   <dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
   </dependency>

   <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
  </dependency>

    <dependency>
<groupId>net.sf.ezmorph</groupId>
<artifactId>ezmorph</artifactId>
<version>1.0.6</version>
   </dependency>

   <dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.2.5</version>
   </dependency>
0
On

Class ListOrderedMap is part of Apache Commons Collections (since version 3.0).

To be able to use it, you must have the JAR file that contains it on the classpath. The JAR file is most likely named commons-collections-3.2.1.jar (or something similar).

If you are creating a web application packaged in a WAR file, then you should put the library in the WEB-INF/lib folder inside the WAR file.