I am writing a command for a maven project in Java using the 'CommandLine' class. The command will take two integer values as parameters on a command line and displays its sum. However, my project does not build and throws exception as follows:
java.lang.ClassNotFoundException: org.apache.commons.logging.impl.LogFactoryImpl
I did some research on the error, and I have added the following dependency to my pom.xml file
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase</artifactId>
<version>0.94.2-cdh4.2.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>2.0.0-mr1-cdh4.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>2.0.0-cdh4.2.1</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<version>1.7.0_05</version>
<scope>system</scope>
<systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>
The command I run on my command prompt is as follows:
java -jar addition-examppe-0.0.1-SNAPSHOT.jar addition 1 2 -dataType Integer
However, I still get the same error on my console as I mentioned above. Any other work around for this particular problem ?
Note: This command is built by me so I have written the Java classes and methods for the operation but the error is simply because of a maven dependency.