Securing JBoss / WildFly Management Interfaces: the easy way

This is the second tutorial about securing WildFly. In the first one, we have discussed how to secure the HTTP channel for Web applications:  How to configure SSL/HTTPS on WildFly In this tutorial we will learn how to secure JBoss / WildFly Management interfaces using Elytron. Firstly, we will at first demonstrate how to create … Read more

How to access Hibernate Session in JPA applications?

In order to access Hibernate objects from a JPA application you can use the unwrap method available in the EntityManager and EntityManager Factory class: EntityManager.<T>unwrap(Class<T>) EntityManagerFactory.<T>unwrap(Class<T>) This method can be used to gain access of JPA-vendor-specific classes. For example, here is how you can retrieve Hibernate’s Session and SessionFactory: Session session = em.unwrap(Session.class); SessionFactory sessionFactory … Read more

How to delete/persist your JBPM process after restart ?

jBPM persists the state of process in a Database (the default H2 emebedded database or an external Database). Therefore, in order to delete your jBPM process each time you start the jBPM Runtime you have to configure the hibernate property “hbm2ddl.auto” in your persistence.xml. Possible values are: validate: validate the schema, makes no changes to … Read more

How to measure the time spent on methods execution in Java

In this tutorial we will show how to measure the time spent on the execution of a Java method by using Byteman tool. There are several tools or product which can trace the execution of Java methods and calculate how much time you are spending in the single methods of your application. This is a … Read more

How to use native Queries in JPA ?

Native Queries are typically used to leverage some optimizations/features of your database which are not available through HQL/JPQL. Consider the following example: @Stateless public class ServiceBean { private static final String QUERY = “SELECT emp_id, name, dept_id, address_id from Employee ” + “START WITH manager_id = ? ” + “CONNECT BY PRIOR emp_id = manager_id”; … Read more

JBoss JMS configuration

JMS defines a vendor-neutral (but Java-specific) set of programming interfaces for interacting across different components or systems by means of messages. Messaging enables distributed communication, which is reliable and loosely coupled. A component sends a message to a destination, which in turn is retrieved by the recipient with the mediation of a JMS server.

This tutorial explains how to configure and run some JMS destinations using all versions of the application server ( WildFly, JBoss EAP 6, JBoss AS 6, JBoss AS 5, JBoss 4).

Read more

What is JBoss and what is used for?

In this tutorial we will learn what is JBoss and what is JBoss used for. The word JBoss is quite generic. In the beginning it was used to reference a Community Opensource project called “JBoss” developed by the JBoss Inc. which was later acquired by Red Hat in 2006. Since JBoss org. was acquired by … Read more

Jakarta EE 9 Hello World example application

In the last post we had our first taste of Jakarta EE 9 with the preview version of WildFly 22: How to run Jakarta EE 9 on WildFly Let’s see now how to build and deploy sample application which uses the ‘jakarta‘ package namespace. The jakarta.jakartaee-api version 9 is now available on the official Maven repository: … Read more

Versioning Entity with Hibernate Envers

The Envers project aims to enable easy auditing/versioning of persistent classes. This can simplify storing and retrieving historical sets of data from the DB. Similarly to Subversion, Envers has a concept of revisions. Basically, one transaction is one revision (unless the transaction didn’t modify any audited entities).   As the revisions are global, having a revision … Read more

JAX-WS Authentication in a nustshell

In the context of an HTTP transaction, BASIC access authentication is a method for a web browser or other client program to provide a user name and password when making a request.
This tutorial shows how to perform BASIC authentication for JAX-WS Web services. Then, as an alternative, we will learn how to use Apache CXF Interceptors as authentication mechanism.

Read more