Category: JAVA

How to solve javax.net.ssl.SSLHandshakeException

If you encounter javax.net.ssl.SSLHandshakeException while developing or deploying Java applications on WildFly, Spring Boot, Quarkus, or microservices, it often indicates a mismatch between your client and server TLS configurations. This exception can result from expired certificates, missing trusted CA certificates, or unsupported TLS versions (TLS 1.0/1.1 being deprecated) in your JVM or server configuration. In this updated guide, you will learn practical, step-by-step methods to diagnose and solve SSLHandshakeException in Java, ensuring your applications remain secure and compliant with modern TLS 1.2 and TLS 1.3 standards while maintaining connectivity to HTTPS endpoints.

Solving java.lang.OutOfMemoryError: Metaspace error

The error java.lang.OutOfMemoryError:Metaspace indicates that you have exhausted an area of JVM which serves as a registry for your application’s Class Metadata. This article is a step-by-step guide to fix Java Metaspace errors with Java 17’s elastic metaspace (JEP 387), diagnostic tools like jcmd, and best practices for JVM configuration.

JBang: Create Java scripts like a pro

JBang is a scripting tool which allows to run Java application with minimal set up, without the need of having a project configuration. In this tutorial we will learn how to use it to run a simple Java application and then we will be looking at a more complex example, which starts a Quarkus application.

A simple Java LDAP Client

This step-by-step guide will show you how to create a minimal Java LDAP Client to test the connection to an LDAP Server and show the LDAP tree using a graphical interface. We will use Docker to trigger a simple LDAP Server so you don’t need to install anything!

Advanced MapStruct Tutorial

MapStruct is a powerful Java annotation processor that simplifies the mapping between Java bean types. In this advanced tutorial, we will explore several advanced features of MapStruct, such as mapping from multiple sources to a target object, using Java expressions in mappings and much more!

How to map JSONPath expressions in Java

JSONPath is a powerful tool for querying JSON data, similar to XPath for XML. Combining JSONPath with Jackson, a popular Java library for JSON processing, allows for advanced mapping of JSON structures to Java objects. This tutorial demonstrates how to map JSONPath expressions using Jackson and Jayway JsonPath.

Converting a PDF to Text in Java made simple

In this tutorial, we will explore how to convert a PDF document into raw text using the Apache PDFBox library in Java. This process can be particularly useful for applications that need to analyze or summarize the contents of a PDF, such as providing input to an AI chatbot.

How to replace Java Security Manager

The Java SecurityManager, a veteran of the platform since JDK 1.0, has been officially deprecated for removal. Besides, Jakarta EE 11 removes support for running with a SecurityManager. This article explores the reasons behind this decision and the future of application security in Java.

Maven is using the wrong version: Explained

In this article we will go through a common issue that you can face when compiling and running applications with Maven. The syntom of this issue is that Maven is using the wrong version during the execution. We will show the cause of the issue and the remediation.

Modern Java Pocket Guide available

Calling all Java enthusiasts! I’m excited to share that my latest tiny ebook is now live—a concise reference guide covering all the top features in Java from version 8 to the upcoming version 22! 🚀

Lombok Tutorial: Code Less, Do More

Lombok is a popular Java library that aims to reduce boilerplate code by providing annotations that generate getters, setters, constructors, and other commonly used methods automatically during the compilation process. In this tutorial we will learn how to use it and which are the pros and cons of this library.

Java Structured Concurrency in practice

Structured concurrency (JEP 453) is a method of organizing concurrent programming in a way that maintains the relationship between tasks and subtasks. This approach aims to make concurrent code more readable, maintainable, and reliable. In structured concurrency, tasks and their subtasks have well-defined entry and exit points. This creates a clear structure similar to how structured programming works in a single thread.

JBang Cheatsheet (2024) for Java Developers

Welcome to the JBang Cheatsheet, your comprehensive guide to mastering this powerful tool for rapid Java development. JBang eliminates the need for complex setup and repetitive configuration, allowing you to focus on writing code and exploring new Java projects. Whether you’re a seasoned Java developer or just starting out, this cheatsheet will equip you with the knowledge and skills to leverage JBang‘s capabilities and accelerate your Java development journey.

How to create a List from Java Objects or Records

In Java, working with collections like lists is fundamental. Often, you’ll need to convert objects or records into lists for various purposes. In this tutorial, we’ll explore different approaches to create a List from a property of an Array of Java objects or Records using practical examples.

Exploring OpenJDK 17 Images: A Comprehensive guide

Java 17 is soon becoming the minimal JDK version for top frameworks such Spring Boot. Selecting the right OpenJDK 17 image for your projects is crucial. This tutorial aims to introduce and test various OpenJDK 17 images available, providing insights into their features and performance.

How to convert a Map to JSON in Java

When working with Java, it’s often necessary to convert data structures to and from different formats, especially when dealing with JSON data. Fortunately, libraries like Jackson provide robust support for JSON processing, allowing seamless conversion between Java objects and JSON representations. In this article, we’ll explore how to convert a Map to a JSON object using Jackson in Java.

How to check the content of a Java KeyStore

Java KeyStores (JKS) provide a secure way to store sensitive data, and they can be used by Java applications to encrypt and decrypt data, authenticate users, and secure network communications. In this tutorial we will check three ways to read the content of a KeyStore information such as the alias the the Certificate.

Java EnumSet and EnumMap made simple

The EnumMap and EnumSet are specialized implementations in Java that are optimized for working with Enum keys and Enum values, respectively. In this article we will learn how to use them and which are the common use cases. Finally, we will also highlight the differences with the standard Map and Set objects.

Mastering Virtual Threads: A Comprehensive Tutorial

Virtual threads, also known as project Loom, are a new feature available in Java 21 that aims to provide lightweight, efficient, and scalable concurrency. They are designed to improve the performance and efficiency of concurrent applications by reducing the overhead associated with traditional thread-based concurrency. At the same time, they allow write asynchronous code in a much simpler way than reactive programming.

How to analyze large Java Heap Dumps

One critical tool in diagnosing memory-related issues is the Heap dump, a snapshot of an application’s memory at a particular point in time. However, as applications become larger and more intricate, heap dumps can also become massive and challenging to analyze. In this article, we will learn how to examine Heap Dump data even with lightly equipped hardware.

Java 21 Unnamed Classes and Instance Main Methods

Java 21 introduces two language core features: Unnamed Java Classes and a new launch protocol which allows running Java classes in a simpler format. In this article we will cover in detail these new features explaining how they can simplify your daily Java coding.

How to solve the error “invalid target release: 17”

This article shows how to fix the compilation issue that you can hit when the target Java release specified in your Maven configuration does not match the version of Java installed on your system. For example, your environment uses Java 11 but your Maven configuration requires Java 17.

How to Fix the HTTP 415 “Unsupported Media Type” Error with JSON

If you’re a developer who has worked with web APIs, you might have come across the HTTP 415 “Unsupported Media Type” error. This error occurs when the server doesn’t support the media type that’s being used in the request. In this tutorial, we’ll discuss one common cause of the HTTP 415 error and how to fix it.

How to catch multiple Exceptions in Java

When working with Java, it’s common to encounter situations where you need to handle multiple exceptions. Fortunately, Java provides a simple and efficient way to do this using the catch block. In this tutorial, we’ll explore how to catch multiple exceptions in Java, along with some tips and code snippets to help you get started.

Java Finally Block – When it is not executed ?

The finally block in Java is used to define a section of code that will always be executed, regardless of whether an exception is thrown or caught. However, there are certain conditions under which the finally block may not execute. In this tutorial, we’ll explore these conditions and provide some code snippets to illustrate them. Hint: read it through as this is a common interview question!

How to list Maven local artifacts using JBang

Listing the available artifacts in your Maven local repository generally requires a Maven project. In this article we will show how to create a simple JBang script to list all dependencies for an artifact in your local Maven repository.

Modern Java interview questions (2023)

Are you going for a Java Interview ? This article contains a list of Interview Questions which are covering modern aspects of Java, such as Functional programming, Stream API, new IO API and much more.

How to capture a Thread dump in Java

In this tutorial, we will learn how to capture a thread dump in Java using different methods depending on the operating system and the environment in which the Java application is running.

Getting started with gRPC on Java

This article is an introduction to gRPC framework which allows to connect services across data centers using high performance Remote Procedure Calls (RPC). To learn the building blocks of this framework, we will show how to create and test your first gRPC application in Java.

Tuning Java applications on Linux

This article discusses which are the best strategies to tune a Linux machine where you are running Java applications. We will first cover the best tools you can use for your analysis and then we will pinpoint the single OS aspects.

Getting started with AtlasMap

This article is a whirlwind tour of AtlasMap Data transformation API and User Interface. We will learn how to use its editor to define mapping rules and how to use them in a sample Java Integration project.

Getting started with Java 18

Java 18 is finally available for download! In this article we will learn some of the most interesting Enhancement Proposals (JEPs) which are now available in the JDK.

How to run JBangs apps from the Catalog

This is the second tutorial about JBang. In the first one we covered the basics of this powerful scripting toolkit: Java scripting with JBang . We will now learn how to install Apps from its rich catalog and how to run scripts on the top of Apps.