Blog Archives
1 2

02: HTTP basics on headers, MIME types, & cookies for Java developers

Q1. What happens when you open up a browser and type a URL to request a Web page or RESTFul web service data? A1. HTTP is a stateless protocol on top of TCP (Transmission Control Protocol). 1) When the IP address is obtained, the browser will attempt to open a…

03: Identifying and fixing NonUniqueObjectException in Hibernate

NonUniqueObjectException is thrown when there is an object already associated with the session with the same id (primary key) (i.e. a duplicate). It is important to understand the concept of a “detached” object in Hibernate. This is one of the most common errors, understanding why and when this error is thrown will save you time in identifying and fixing this issue.

Q. What is a detached object in Hibernate?

When you close an individual Hibernate Session, the persistent objects you are working with become detached. This means the objects are still in the application’s memory, but Hibernate is no …


04: Identifying and fixing LazyInitializationException in Hibernate

LazyInitializationException is thrown when an object becomes detached, and if you try to access associated (i.e. proxied) object(s) of a detached object.

Q. What is a detached object in Hibernate?

When you close an individual Hibernate Session, the persistent objects you are working with are detached. This means the object is still in the application’s memory, but Hibernate is no longer responsible for tracking changes to that object. If your detached object has any associated objects, for example a “Book” object might have an associated proxied “Author” object. So, when you do something like


05: Debugging Hibernate & handling 4 common issues

#1. Enable Logging in your log4j.xml,, or myapp-logback.xml

In the file, you can enable Hibernate SQL logging as shown below

or in your log4j.xml or myapp-logback.xml as

06: Debugging NoSuchBeanDefinitionException in Spring

#1. Adding the @Named annotation to the interface instead of the implementation Adding the @Named, @Component, @Repository, etc annotation on the interface as opposed to the implementation class. The code below can throw “NoSuchBeanDefinitionException”

07: Debugging Spring Transaction Management

Never just trust that adding @Transactional annotation is going to create a transactional boundary for your service layer. EventRestController –> EventMergeProcesorImpl –> EventControlDAOImpl The @Transactional annotations added to “public” methods of the EventMergeProcesorImpl. Spring creates a proxy around the “EventMergeProcesorImpl”. So, here are a few tips to debug #1. Run…

5 Ways to debug thread-safety issues in Java

Interviewers often judge your experience with debugging skills. For example, debugging jar hell issues, debugging SSL issues, debugging hibernate issues, debugging transaction management issues, etc. All these are covered in detail under the key areas “Key Area – Debug xxxx” How will you debug thread-safety issues in Java? A very…

7 Java debugging interview questions & answers

Q1. How would you go about debugging thread-safety or concurrency issues? A1. #1: Manually reviewing the code for any obvious thread-safety issues. Good knowledge of multi-threading is required. #2: List all possible causes and add extensive log statements and write test cases to prove or disprove your theories. The log…

Chrome Postman to test and debug RESTful Web Services

Step 1 You need to get the Postman extension for the Google chrome browser.

Step 2 Search and add POSTMAN.

Step 3 Once installed, open it from the Apps link.


Step 4 Set the TEST URL, HTTP headers (especially the content type application/json, etc), and HTTP method (GET, POST, PUT, etc) and then click on send.



for the completeness, the REST service could have been implemented using Spring MVC, and the controller implementation looking like

Debugging “NoSuchMethodError” in Java

The JAR hell issues also lead to exceptions like NoSuchMethodError or IllegalArgumentException. I have already discussed debugging JAR Hell issues. #1 Check the war file for any duplicate versions of the same jar The Maven’s transivie dependency might bring multiple versions of joda libraries like “joda-time-1.2.0” and “joda-time-2.3”. The older…

Debugging connection refused issues in Java with 9 tips

Possible reasons for “refused connections” 1) Client & Server are not connected by the LAN. For example, they can be in the different zones. 2) The Server might not be running. 3) The server might be listening on a different port or the server might have not started properly as…

Debugging JAR hell issues in Java

The following 3 questions are frequently asked by Java developers as an industrial strength Java project will have 100+ jar files. How often have you come across a Java application that requires different versions of the same library? How often do you see exceptions like NoSuchMethodError or IllegalArgumentException. Here are some tips to solve the JAR hell problem. These 6 tips will go a long way in resolving your jar problems.

Q1. Which Jar has a particular class?

Tip #1: Go to and search for the class file. For example, I want to find the jar file that …

Debugging Java version issues

1. Error: Unsupported major.minor version 51.0 error?

Debugging Certificates do not conform to algorithm constraints

Why? You may have a certificate with SHA1RSA key size less than 1024 bits or you have a certificate in your chain that uses MD2RSA.

Explanation? MD2 was widely recognized as insecure and thus disabled in Java in version JDK 7 onwards. If you check the “” file under “$JAVA_HOME/jre/lib/security”, you will see a line as shown below. This means disable MD2 for all and RSA for certs with key size less than 1024 bits.

So, if you have a …

Debugging like a pro with eclipse IDE tutorial for Java developers

Often you get to work on a fully functional Java application that is already in production to fix production issues or to enhance its existing functionality. As a new Java developer in the team, it is not easy to get started and contributing. The approach would be slightly different from working on a brand new project. Here are a few tips that will help you hit the road running as quickly as possible.

This post will also help you answer a common developer interview question —

Q. How will you hit the road running fast on an enhancement or …

Debugging LinkageErrors in Java

What is a LinkageError in Java?

A jar that is being loaded by two different classloaders can throw a java.lang.LinkageError. For example, your application server (e.g JBoss) on startup loads that jar or has a directory with that jar. Also, your EAR or WAR you are deploying has that jar in its say WEB-INF/lib. The two jars can conflict at runtime. Each class loaded is unique to the class loader even if it has the same package and class name.

What are some of the libraries that cause this pain?

log4j.jar, commons-*.jar, mail.jar, quartz.jar, hibernate*.jar, XML API jars, cglib.jar, antlr.jar, …

Debugging Maven issues and tips

Debugging Maven issues and tips. At times maven can cause issues relating to jar conflicts or not having the required jar file in the repository.

Q. In your experience, what are some of the challenges you faced with maven, and how do you over come them?
A. When it works, which is 95% of the time it is a handy tool, and when it doesn’t, it can be a challenge. Some of the challenges can be resolved by keeping some tips in mind. Most often it is due to the lack of understanding of how Maven works.

#1. You may

Debugging Spark applications written in Java locally by connecting to HDFS, Hive and HBase

This extends Remotely debugging Spark submit Jobs in Java. Running Spark in local mode When you run Spark in local mode, both the Driver and Executor will be running in the same JVM and is very handy to debug the logic of your transformations. You can run within an IDE…

Debugging SSL issues in Java & tools to debug

Q1. What are some of the issues you encounter with SSL handshake? A1. Some of the issues you try to debug are Presence of a valid certificate in trust store Incorrect certificate chains in the client or server truststore Invalid key algorithm used for private keys Expired certificate Incorrect passwords…

Finding your way around YARN and Spark on Cloudera

What is Apache Hadoop YARN? Apache Hadoop YARN (Yet Another Resource Negotiator) is the prerequisite for Enterprise Hadoop for dynamic allocation oc the cluster resources. For example, when you run a Spark job on YARN as opposed to in standalone mode, you can will take advantage of categorizing, isolating, and…

1 2

300+ Java & Big Data FAQs - Quick Prep

Java & Big Data Tutorials