H2 Console in versions between 1.1.100 and 2.0.204 is vulnerable as it allows loading of custom classes from remote servers through JNDI, like the Log4Shell vulnerability. Let’s see in detail the issue and how this can affect our environment.
WildFly Datasource configuration
A javax.sql.DataSource objects simplifies access to a Database by implementing classes that allow you to use connection pool.
In WildFly, the DataSource object is available in all server configurations through the datasources subsystem. Out of the box, an H2 Datasource is available for testing purposes.
You can learn more about DataSource Configuration through the following resources:
DataSource set up
How to set up a Datasource with WildFly
How to configure the DataSource Connection pool
Configuring Agroal Datasource on WildFly
Creating a Datasource using a CLI script
Creating a Datasource using the Web Console
Hardening a DataSource
How to validate Database connections in JBoss / WildFly
How to encrypt the Datasource password
Monitoring / Troubleshooting
How to trace JDBC statements with JBoss and WildFly
Solving “No managed connections available within configured blocking timeout”
Using try-with-resources to close database connections
DataSource and Enterprise applications
How to deploy a DataSource in jboss at application level
How to inject a DataSource in your Enterprise applications
Advanced topics
Configuring Datasource JTA and XA settings
How do I access the specific driver Connection with JBoss
Database specific tutorials
Configuring a PostgreSQL DataSource
Configuring MS SQLServer DataSource
Configuring a MySQL DataSource
H2 Database cheatsheet
Here is a cheat sheet for H2 Database which shows some common Data definition, Data modification statements, JDBC Settings and H2 Database server administration. Firstly, if you are looking for an introduction to using H2 Database in your applications, then check this tutorial: H2 database tutorial DDL cheat sheet Table Creation (Basic) CREATE TABLE TEST(ID … Read more
How do I get the list of Datasources available ?
A DataSource is the preferred means of getting a connection from a Database. Let’s learn how to fetch the list of Datasources which are configured in the application server using the CLI and programmatically.
How to install a JDBC Driver on WildFly
A JDBC Driver is able to call standard SQL statements into the vendor-specific database protocol. In this tutorial we will learn how to download and install a JDBC Driver on WildFly / JBoss EAP 7.
How to inject a Datasource in your Enterprise applications
To inject a Datasource in your Enterprise applications you can use the javax.annotation.Resource annotation to declare a reference to that resource. The @Resource can decorate a class, a field, or a method. The container will inject the resource referred to by @Resource into the component either at runtime or after its initialization. In the following … Read more
How do you connect a Datasource to a Cluster ?
When connecting WildFly / JBoss EAP to a Database cluster you need to provide an appropriate JDBC Connection String. We’ll examine three popular Database: Oracle, MySQL and PostgreSQL. Oracle Real Application Clusters (RAC) Oracle Real Application Clusters (RAC) is a software component you can add to a high-availability solution that enables users on multiple machines … Read more
How to connect to a DataSource from a remote client?
WildFly and JBoss EAP 6/7 no longer support remote JNDI lookup of datasource objects. If you attempt to lookup a Datasource object from a remote client, the following error will be thrown: ERROR: org.jboss.remoting3.MessageCancelledException Exception in thread “main” org.jboss.naming.remote.protocol.NamingIOException: Failed to lookup [Root exception is java.io.NotSerializableException: org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] As an alternative, it is recommend using an … Read more
How to deploy a DataSource in jboss at application level ?
Data source definitions can be also packed in your application so that you don’t have to modify at all the server configuration. When deploying data source on WildFly as part of your application you have to add them in a specific folder, which varies depending on the application package format. For example, for a Web … Read more
How to add Connection properties to your JBoss DataSource ?
In this article we will learn how to configure Connection Properties in a JBoss / WildFly Datasource. Let’s step back first. To configure Connection Pooling (non-XA) to a Database you have two options: Using a class which implements java.sql.Driver Using a class which implements javax.sql.DataSource When using a Class which implements java.sql.Driver, you can simply … Read more
JBoss run out of Connections ? here is how to fix it
Have you got No ManagedConnections available error message ? … javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/MyDataSource … javax.resource.ResourceException: IJ000655: No managed connections available within configured blocking timeout (30000 [ms]) In this tutorial we will learn which are the possible causes to this problem. # 1 Your connection pool is too small Increase … Read more