Es werden Posts vom Februar, 2016 angezeigt.

Spring Framework on OpenShift: persistence.xml and EntityManager Configuration on Wildfly 10 and MySQL

Running an Web Application with Spring Framework 4.2.x with Spring-Data-JPA and MySQL on OpenShift the RedHat Cloud is good with Wildfly10.

But how to configure the MySQL Database for Spring-Data-JPA?

First Step: edit persistence.xml. Here is an Example:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xsi:schemaLocation=""> <persistence-unit name="mySimpleWorkListPU" transaction-type="JTA"><jta-data-source>java:jboss/datasources/MySQLDS</jta-data-source>

MySQL DataSource for Wildfly10 like Openshift

how to configure Wildfly10 to have a DataSource for MySQL like Openshift the RedHat Cloud.

I installed Wildfly10 on ~/srv/wildfly-10.0.0.Final

Step 1: Add MySQL Driver to modules:

Download the mysql-driver mysql-connector-java-5.1.38.jar from any Maven Repository e.g.:

go to WildFly modules Directory:
cd wildfly-10.0.0.Final/modules/system/layers/base
mkdir -p mysql/mysql-connector-java/main

copy  mysql-driver mysql-connector-java-5.1.38.jar here.

add a file module.xml with content:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" 
        <resource-root path="mysql-connector-java-5.1.38.jar"/>
        <!-- Insert resources here -->
        <module name="javax.api"/>
        <module name="…