About Custom Input Format Code (in module 6): can not compile (missing org.apache.commons )



0
I'm trying to work on the homework about Custom Input Format, and I have tried the following three ways:

First thing I did is copying the .java files under "custominputformat" folder ( the solution ) to my self-built java project. This is what I did for all previous homework and it worked fine. But this time eclipse gives me compilation error. Specifically, in the "CustomInputFormat.java" file, there is a red wavy line under "InputSplit arg0" and the message is
"The type org.apache.commons.logging.Log cannot be resolved. It is indirectly referenced from required .class files". There is no other error in other files.

Then I import the whole project "module5-dz" (in module 6 but labeled module5) into eclipse as a java project. Still doesn't work.

According to the previous batch video, maven can install all packages for you. So followed all the instructions in the video and installed maven on eclipse. I then import the project as a maven project into eclipse, but this time the error comes from "pom.xml": "Missing artifact jdk.tools:jdk.tools:jar:1.6". I saw that the default library is chosen as J2SE-1.5, so I change it to 1.6 but still doesn't work.

I think the problem might be that I'm missing the "org.apache.commons" the package. I checked the "hadoop-core-1.2.1.jar" and I don't see that package. Maven might be able to solve the problem but in my case it is causing more error.

I don't want to spend too much time on making maven to work. I think the easiest solution is to provide us a updated hadoop jar that contains the necessary components. I'm wasting a lot of time on these compilation problems, and I want to focusing more on the algorithm itself.

Thank you very much!

4 Answer(s)


1

Hi Bin,

Please add apache-commons jar to your project build path / class path, if you haven't done that already. This is a utility jar that is available for download which holds a lot of utility methods.

I think that will solve your issue.

0

Hi Amrit,

Do you know where to download a specific jar file? Do you happen to have the utility.jar or apache-commons.jar ? If you don't mind, you can Email the file to me at regihan1124@gmail.com

Thanks!

1

Hey Bin,

Please find the below link to download the jar.

http://www.java2s.com/Code/Jar/a/Downloadapachecommonsjar.htm

As your project is looking for the org.apache.commons.Logging.Log, please download the following jar from the above link and add it to your class path.

apache-commons-logging.jar

0

Hi Amrit,

Your solution works! Thanks!