There are basically two options to do what you want to do:
1) Wrap a command line call to hadoop within your servlet. That's super ugly but is easiest to set up, as you do not have to mix you Web application code base and hadoop. Here's an example on how to do that:
String[] cmd = new String[] { <hadoop command goes here> };
Process process = Runtime.getRuntime().exec(cmd);
2) The other, better alternative is to package your hadoop code and the hadoop dependencies in your servlet. I would stringly suggest you use maven for dependecy management. You will have to do the following to run your map reduce job from your servlet: - package hadoop and your job jar - Create a Configuration object which reflects your cluster (especially dfs and mapred hosts) - implement Tool