Thursday, April 12, 2018

java - command not found - Fix for CentOS

Add the following lines after adjusting the path for your system to /etc/.bash_profile
Or simply exporting the following in the given terminal session would also work:

export JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera/bin
export PATH=$PATH:$JAVA_HOME

Log out and log in if you chose to edit the .bash_profile file. Try by entering java to see if the same error message is thrown or not.

Saturday, September 30, 2017

Steps for Java 8 setup on Cloudera Distribution Hadoop

  1. Stop Cloudera Management Service
  2. Stop Cloudera Cluster
  3. Stop all Cloudera Agents (on all nodes) - sudo service cloudera-scm-agent stop
  4. Stop the Cloudera Manager Server - sudo service cloudera-scm-server stop
  5. Download JAVA 8 from Oracle using wget
  6. Extract the JDK
    • gunzip jdk-8u60-linux-x64.tar.gz 
    • tar -xvf jdk-8u60-linux-x64.tar jdk1.8.0_60/
  7. Copy the JDK folder to /usr/java/
  8. Append export JAVA_HOME=/usr/java/jdk1.8.0_60/ to file /etc/default/cloudera-scm-server
  9. Start Cloudera Manager Server - sudo service cloudera-scm-server start
  10. Start all Cloudera Manager Agents - sudo service cloudera-scm-agent start
  11. Navigate to Hosts -> Configuration -> Java Home Directory, and set it to/usr/java/jdk1.8.0_60
  12. Finally, inside Cloudera Manager page, start the Cluster and the CM service. DONE!

Friday, September 29, 2017

Apache Spark Resource Allocation Guide

This site does a great job at explaining how to divide available resources of every node in a cluster to Spark application in order to harness the full capacity of the cluster.

http://site.clairvoyantsoft.com/understanding-resource-allocation-configurations-spark-application/


Another one!

A 2 part guide by Cloudera Engineering team explaning how to tune Spark-application parameters to achieve optimal performance!
http://blog.cloudera.com/blog/2015/03/how-to-tune-your-apache-spark-jobs-part-1/
https://blog.cloudera.com/blog/2015/03/how-to-tune-your-apache-spark-jobs-part-2/

Java EE 6 - Java Beans Validation

A very good resource on how to validate Java Beans after receiving them from the webforms.

http://docs.oracle.com/javaee/6/tutorial/doc/gircz.html


Friday, September 22, 2017

Some Spring MVC-Javascript Notes

  1. When there's a page locked to a session and one would like the page to detach from the session if the user navigates to some other page, this can be done by Javascript. JS's 'onunload' event comes pretty hand in situations like these.
  2. Let's say you make a post request with a modelattribute inside a form. The modelattribute fails to bind because of JavaBeans constraint annotations on the Java entity definition class. This could happen for several reasons. For eg, let's say you had a constraint on the length of the name and the supplied length was smaller than required. The binding shall fail and the BindingResult object shall have the errors. Now, you don't have to reattach the modelattribute to the ModelMap object. All you have to do is to return the String in the requestMapping method and have necessary Spring-error fields ready to display the related binding error.
  3. There has been this confusion about BindingResult and @InitBinder for quite some time now. In short, modelAttributes bind automatically with the Java object, as long as the fields within are of primary types. When there's a user-defined or complicated object field inside modelattribute class, to help them bind with the received modelAttribute, you need @InitBinder definition, for each one of the complex fields. BindingResult will simply hold all that went wrong while trying to bind the received modelAttribute into a Java object.

Monday, February 13, 2017