Monthly Archives: July 2014

Java Collections Interview Questions and Answers

Below are some of the Java Collections Interview Questions and Answers. Java Collections Interview Questions and Answers 1. What is a collections ? Collection is an object which manages a group of objects called elements which are of same kind, that is they all descents from common parent type. 2. What are the core collection interfaces? Collection,Set, SortedSet, List, Queue,Deque and Map. SortedSet and SortedMap interfaces are sorted versions of Set […]


Error Scenario: java.lang.UnsatisfiedLinkError: org.apache.hadoop.util.NativeCodeLoader.buildSupportsSnappy()Z We will receive this error message if we try to read snappy files without having snappy compression/decompression codec installed properly. 


Resolution: We should install snappy compression/decompression codec to resolve this error message and its corresponding .so files should be available (copied from /usr/local/bin) in $HADOOP_HOME/lib/native directory location. For Snappy Installation instructions please read through this post.

Unable to open a test connection to the given database 2

Error Scenario 1: In this post, we will discuss about a few varieties of error message Unable to open a test connection to the given database and their resolutions. Unable to open a test connection to the given database / Communications link failure Below is the error message for this communications link failure:

Root Cause: We will get the above error message, if we specify incorrect hostname: port values in property javax.jdo.option.ConnectionURL in […]

Java Interview Questions and Answers – Part 5

Java Interview Questions and Answers for experienced 1. What is the difference between error and an exception? Errors are abnormal conditions that should never occur. Not to be confused with the compile time errors. A method is not required to declare in its throws clause any subclasses of Error that might be thrown during the execution of the method but not caught. An exception is a condition that a programmer […]

Java Interview Questions and Answers – Part 4

Java Interview Questions and Answers 1. What is the difference between the Boolean & operator and the && operator? If an expression involving the Boolean & operator is evaluated, both operands are evaluated. Then the & operator is applied to the operand. When an expression involving the && operator is evaluated, the first operand is evaluated. If the first operand returns a value of true then the second operand is […]

Querying HDFS File System

FileStatus: Java API for Hadoop Distributed file system provides one important class org.apache.hadoop.fs.FileStatus for querying HDFS File System. This class encapsulates the file system meta data. We can obtain meta data about the files, directories, including file length, block size, replication, modification time, ownership, and permission information. We can get the instance of FileStatus by calling getFileStatus() method on file system object. Below are some of the important methods on […]

Java Interface to HDFS File Read Write 2

Java Interface to HDFS File Read Write This post describes Java interface to HDFS File Read Write and it is a continuation for previous post, Java Interface for HDFS I/O.  Reading HDFS Files Through FileSystem API: In order to read any File in HDFS, We first need to get an instance of FileSystem underlying the cluster. Then we need to get an InputStream to read from the data of the file. We can use IOUtils class […]

Java Interview Questions and Answers – Part 3 1

Java Interview Questions and Answers 1. What is JIT Compiler ? JIT compiler coverts a byte code of one operating system to the current operating system’s executable code. This instruction is given by JVM of the current system. The byte is compiled into native platform code. The execution speed is greatly improved by this process, because the platform is directly executing the native byte code. 2. What is the difference […]

Java File Input and Output

Java File Input and Output: A file is identified by its path through the file system, beginning from the root node. A symbolic link is a special file that serves as a reference to another file. when a symbolic link is deleted, or renamed then link itself is deleted, or renamed and not the target of the link. A Path object contains the file name and directory list used to […]

Java Basic Input and Output

JAVA Basic Input and Output Below are some basic and important notes on File input/output through Java Programming. In Java, I/O Streams are a powerful concept that simplifies I/O Operations. An I/O Stream represents an input source or output destination. Java programs uses an input stream to read data from a source, one item at a time. output stream is used to write data to a destination, one item at […]

Java Binary Input and Output

Java Binary Input and Output: Java provides two types of streams to address binary input and output operations. Data Streams: Data stream API supports binary input/output of Java Primitive data types (boolean, char, byte, short, int, long, float, and double) and String values.  Java provides two important interface for Data Streams – DataInput & DataOutput.  And the classes implementing these interfaces are – DataInputStream & DataOutputStream respectively. Data type   […]

Basic JAVA Programming Notes 1

This post describes basic JAVA Programming Notes. Comments: Java Comments can be specified in 3 styles: Mark each line with a // at the beginning of each comment line. /* and */ comment delimiters can be used tp block off a longer comment. Third kind of comment can be used to generate documentation automatically. This comment uses a /** to start and a */ to end. Data Types: In Java […]

Access denied for user ‘APP’@’localhost’ (using password: YES)

Error Scenario: Unable to open a test connection to the given database  or Access denied for user ‘APP’@’localhost’ (using password: YES) This error message (Access denied for user ‘APP’@’localhost’) will be received while trying to connect hive service through MySQL local metastore.

Root Cause: When we don’t provide username (javax.jdo.option.ConnectionUserName) and password (javax.jdo.option.ConnectionPassword) configurations in hive-site.xml for accessing MySQL local metastore database we will receive this error message. By default these two […]

datastore driver was not found in the CLASSPATH 1

Error Scenario: The specified datastore driver (“com.mysql.jdbc.Driver”) was not found in the CLASSPATH We usually get this error message while configuring Hive Local Metastore through MySQL database.

Root Cause: If the JDBC driver JAR file for MySQL (Connector/J) is not on Hive’s classpath, ( in Hive’s lib directory – $HIVE_HOME/lib), we will get this error message. Resolution: We have to download this MySQL Connector/J jar file from MySQL downloads pages . For […]