Running a Java action through Oozie is very easy. But there are some things you need to consider before you run your Java action. In this tutorial, I'm going to execute a very simple Java action. I have a JAR file TestMR.jar which is a MapReduce application. So this application will be executed on the Hadoop cluster as a Map-Reduce job.
TestMR.jar file has a class TestMR.java which has a public static void main method(String args[]) that initiates the whole application. To run a Java action, you need to pass the main Java class name through the tag <main-class>.
This is the workflow.xml file for a Java action with minimum number of parameters:
Your Java action has to be configured with <job-tracker> and <name-node>. And as you know, Hadoop will throw exceptions if the output folder is already exists. That's why I'm using <prepare> tag which will delete the output folder before execution. My jar also takes command line arguments. One of the argument is "-r 6" which means how many reducers I want to use for the MR job. So I'm using "<arg>" tag to pass command line arguments. You can have multiple <arg> for a single Java action. As like other actions, to indicate a "ok" transition, the main Java application needs to be completed without any error. If it throws any exception, the workflow will indicate a "error" transition.
Now comes to the folder structure inside HDFS. When Oozie executes any action, it automatically adds all JAR files and native libraries from the "/lib" folder to its classpath. Here, "/lib" folder is a sub-folder inside Oozie workflow application path. So, if "java-action" is the workflow application path then the structure would be:
- java-action
- java-action/workflow.xml
- java-action/lib
In my HDFS, I have:
And here is my job.properties file:
That's pretty much it! Now you can execute your workflow by:
Remember, this is a very basic and simple workflow to run a Java action through Oozie. You can do a lot more than these by using several other options provided by Oozie. Once you are able to run a simple workflow, I would recommend you to go through Oozie documentation and try some workflows with different settings.
Consideration: Be careful about what you have inside your "/lib" folder. If the version of the library which you are using for your application conflicts with Hadoop's library file's version, it will throw errors and those type of errors are hard to find. To avoid those kind of errors, better to match your library files with the versions you have inside "/usr/lib/[hadoop/hive/hbase/oozie]/lib" folder on your client node.
Note: For privacy purpose, I had to modify several lines on this post from my original post. So if you find something is not working or facing any issues, please do not hesitate to contact me.
As a beginner, i really find your blog very useful thanks for sharing.
ReplyDeleteHadoop training velachery
Great Article
DeleteProject Centers in Chennai
Final Year Project Domains for CSE
JavaScript Training in Chennai
JavaScript Training in Chennai
Great Article android based projects
DeleteJava Training in Chennai
Project Center in Chennai
Java Training in Chennai
projects for cse
The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training
i got EJ001 error code with "could not locate sharelib. It is compulsory to use sharelib to run mapreduce job with oozie.
ReplyDeleteYes, you can install sharelib if you haven't yet. If you don't have sharelib, Oozie will not find all required libraries. Follow this link to know more about sharelib: http://blog.cloudera.com/blog/2012/12/how-to-use-the-sharelib-in-apache-oozie/
Delete
ReplyDeleteIn the site was very excellent,i think this is very best one compare others and then the more information to get after read this post.
HADOOP Training in Chennai
Hi,
ReplyDeletedid you created the .jar file and uploaded to HDFS.? If so please let me know how did you created a jar file.
Nice post Thanks for sharing it
ReplyDeleteHadoop Training in Chennai
Thanks for sharing this information article..
ReplyDeleteOracle Training Institute in Chennai | No.1 Oracle Training Institute in Chennai
The information shared was very much useful my sincere thanks for sharing this post Please continue to share this post
ReplyDeleteHadoop Training in Chennai
This is really an amazing blog with smart and cute content..Thanks for sharing an informative article..
ReplyDeleteBE Project Center in Chennai | ME Project Center in Chennai | MBA Project Center in Chennai | BBA Project Center in Chennai
This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information, this is useful to me…
ReplyDeleteJava Training Center in Chennai | Best J2EE Training Center in Chennai | No.1 Java Training Institution in Velachery | Core Java Training in Chennai
Nice post..Thanks for sharing your wonderful information. keep updating..
ReplyDeleteAndroid Project Center in Chennai | Android Project Center in Velachery
Good one. The post is very simple and easily understood. Helpful for java beginners. Thanks for sharing and keep updating.
ReplyDeleteReally awesome blog on iOS. Very interesting to read. Thanks for sharing.
Final Year Project Center in Chennai | IEEE Project Center in Chennai | Diploma Project Center in Chennai
great
ReplyDeleteNice post! It is really interesting to read from the beginning & I would like to share your blog to my circles, keep your blog updated.Thanks
ReplyDeleteBest Photoshop Training Institute in Chennai | No.1 Adobe Photoshop Training Institute in Velachery
Nice post..Thanks for sharing your wonderful information. keep updating..
ReplyDeletemobile website builder
This is really an amazing blog with smart and cute content..Thanks for sharing an informative article..
ReplyDeletewhite label website builder
mobile website builder
Thankfulness for truly being mindful and furthermore to decide on certain superb aides a great many people truly need to know about.Authorized Dot Net training in chennai
ReplyDeleteGreat article,
ReplyDeletethank you very much for sharing this awesome post with us.
Excellent Summer Courses in Guindy | Best Summer Classes in Chennai
In a recent test, of 126 jobs advertised as available in a large city, an employment organisation found that the actual number of jobs fulfilling the search criteria was 10! Online Jobs
ReplyDeleteYour good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
ReplyDeletedatascience training in chennai
Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..
ReplyDeleteInDesign Certification Center in Chennai | No.1 InDesign Training in Keelkattalai
very nice..it's really an informative post..thanks for sharing..
ReplyDeleteBlue Prism Certification Center in Chennai | No.1 RPA Blue Prism in Medavakkam
Your Blog is big and there is a lot of good information! Thanks...
ReplyDeleteUIPath Certification Exam Center in Chennai | Best UIPath Training in Guindy
Nice and good blog to read.... really i gathered some information thanks for sharing.
ReplyDeletePython Certification Center in Chennai | No.1 Python Exams in Nanganallur
It was really useful information to us
ReplyDeletejava TRAINING INSTITUTE IN CHENNAI | java TRAINING INSTITUTE IN VELACHERY
Thank for sharing a blog to us it was really an wonder full information
ReplyDeleteto gathering more idea
Web design and development Training Institute in Chennai | Web design and development Training Institute in Velachery
very nice.....!
ReplyDeleteinplant training in chennai
inplant training in chennai
inplant training in chennai for it
italy web hosting
afghanistan hosting
angola hosting
afghanistan web hosting
bahrain web hosting
belize web hosting
india shared web hosting
nice...................
ReplyDeleteinplant training in chennai
inplant training in chennai
inplant training in chennai for it
algeeria hosting
angola hostig
shared hosting
bangladesh hosting
botswana hosting
central african republi hosting
shared hosting
very useful post... thank you for giving this post....
ReplyDeleteinplant training in chennai
inplant training in chennai
inplant training in chennai for it
Australia hosting
mexico web hosting
moldova web hosting
albania web hosting
andorra hosting
australia web hosting
denmark web hosting
This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information, this is useful to me…
ReplyDeleteAWS training in Chennai
AWS Online Training in Chennai
AWS training in Bangalore
AWS training in Hyderabad
AWS training in Coimbatore
AWS training
Good Post! it was so good to read and useful to improve my knowledge as an updated one, keep blogging. After seeing your article I want to say that also a well-written article with some very good information which is very useful for the readers....thanks for sharing it and do share more posts like this.
ReplyDeleteAngularJS Training in Pune
Достойный и проверенный поставщик всегда может показать невероятный сортамент кафельного покрытия для кухни. Фирма Сотни.ру реализует absolut keramika sajalin на протяжении пятнадцати лет.
ReplyDeleteThanks for sharing the best information.
ReplyDeletemultithreading concept in java
types of control statements
how to create string in java
java non primitive data types
angularjs interview questions for freshers
Awesome blog with lots of information. It is really helpful for all.
ReplyDeleteDigital Marketing training in marathahalli and Btm Layout
Digital Marketing training in bangalore
best Digital Marketing training in marathahalli bangalore
Digital Marketing training and placement in bangalore
Digital Marketing course content
Digital Marketing course fees
Digital Marketing interview questions and answers
Digital Marketing training institutes in bangalore
Digital Marketing training centres in bangalore
Digital Marketing training classes in bangalore
It is really a very informative post for all those budding entreprenuers planning to take advantage of post for business expansions. You always share such a wonderful articlewhich helps us to gain knowledge .
ReplyDeleteThanks for sharing such a wonderful article, It will be deinitely helpful and fruitful article.
Amazon Web Services Training in Chennai |
AWS Training in Chennai |
AWS certification course in Chennai |
AWS course in Chennai
Looking a more unique post from your article.Great Article, very useful information, thank you !!
ReplyDeleteReactjs Training in Chennai |
Best Reactjs Training Institute in Chennai |
Reactjs course in Chennai |
Nice Blog!
ReplyDeletejava full stack course in hyderabad
java full stack developer course in hyderabad
java full stack training in hyderabad
java full stack institute in hyderabad
best java full stack developer course in hyderabad
Nice Blog!
ReplyDeletejava full stack course in hyderabad
java full stack developer course in hyderabad
java full stack training in hyderabad
java full stack institute in hyderabad
best java full stack developer course in hyderabad