Configuring Mariadb datasources in wildfly

While i had been using glassfish/payara for most of my projects, i decided to switch to Wildfly for a project in which i preferred to have ActiveMQ als a JMS provider.

Using the JBOSS_CLI to create the JMS configurations was quite easy, but i did have a small challenge in figuring out how to create the mariadb driver/(xa)datasource.

This is what i ended up using:

1. Configure-buildTime.sh – a script that i run during docker build

2. jdbc.command.cli – the JBOSS_CLI script that registers the driver and datasources.

Notice how i give my parameters a default value recursing to the parameter itself. This is done because the JBOSS_CLI apparantly tries to expand the values (although default configured not to do so version 21.0.1), and i could not find another way to prevent this – it feels like a bug. My goal was to have the parameters to be resolved at image-runtime – and that worked!

3. My war/META-INF/persistence.xml

Leave a Reply

Your email address will not be published. Required fields are marked *