Copy the driver of MySql in the TomEE lib directory:

Mysql

You have to modify the config file tomEE/conf/tomee.xml

In the file you have to add your mysql configuration:

Tomee

<Resource id="pmone" type="DataSource">
JdbcDriver com.mysql.jdbc.Driver
JdbcUrl jdbc:mysql://localhost:3306/pm
UserName user
Password secret
JtaManaged true
</Resource>

Your persistence xml has to use the datasource defined in tomee.xml (in this case ‘phone’)

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
 
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
 
<persistence-unit name="pmWebPU">
<jta-data-source>pmone</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
 
<properties>
 
</properties>
</persistence-unit>
</persistence>

Done 🙂