In my case I use the wildfly
, I did the following:
I set it up in the file standalone.xml the following entries:
In <datasources
I added:
<datasource jndi-name="java:jboss/datasources/pokemax" pool-name="pokemax" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/banco?useTimezone=true&serverTimezone=UTC</connection-url>
<driver>mysql</driver>
<security>
<user-name>user</user-name>
<password>senha</password>
</security>
</datasource>
In <drivers
:
<driver name="mysql" module="com.mysql">
<driver-class>com.mysql.jdbc.Driver</driver-class>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
And add the driver of mysql
in the directory: /opt/wildfly-10.1.0.Final/modules/system/layers/base/com/mysql/main.
If folders do not exist you can create them normally.
Still in this directory, add a file called module.xml with the following information:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-6.0.4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
Ready, just watch out for your settings like database, user, password, mysql driver version, etc.
Which Server is Using?
– Roknauta
You’re using hibernate too?
– DiegoAugusto