I am developping a web application (Eclipse, TomEE) and I try to communicate with a MySQL database :
- I have created the database
- I have included EclipseLink and MySQL-Driver
- the connection is OK (I tried the ping and it is OK)
When I try to persist the data I have this error
Grave: could not reopen database
org.hsqldb.HsqlException: Database lock acquisition failure: lockFile:org.hsqldb.persist.LockFile@81911f7a[file =C:\Program Files\eclipse\data\hsqldb\hsqldb.lck, exists=false, locked=false, valid=false, ] method: openRAF reason: java.io.FileNotFoundException: C:\Program Files\eclipse\data\hsqldb\hsqldb.lck (Le chemin d’accès spécifié est introuvable)
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.persist.LockFile.newLockFileLock(Unknown Source)
at org.hsqldb.persist.Logger.acquireLock(Unknown Source)
at org.hsqldb.persist.Logger.open(Unknown Source)
at org.hsqldb.Database.reopen(Unknown Source)
at org.hsqldb.Database.open(Unknown Source)
at org.hsqldb.DatabaseManager.getDatabase(Unknown Source)
at org.hsqldb.DatabaseManager.newSession(Unknown Source)
at org.hsqldb.jdbc.JDBCConnection.<init>(Unknown Source)
at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source)
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:278)
...
I don't understand why it is about hsqldb whereas I have configured MySQL
I have in src/META-INF the persistence.xml file :
<?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="UP" transaction-type="JTA">
<class>jpa.User</class>
</persistence-unit>
</persistence>
and I call the entityManager like this :
@Stateless
public class UserFacade extends AbstractFacade<User> implements UserFacadeLocal {
@PersistenceContext (unitName="UP")
private EntityManager em;
...
}