hi all i got two different error when i run my java apps using hibernate persistence.xml 1. Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named FastMatch 2.Caused by: java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.Driver
for the first error i have add my persistence.xml like this one : here my persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="FastMatch" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>com.dxtr.hibernate.newOrderSingleEntity</class>
<properties>
<property name="eclipselink.logging.level" value="INFO"/>
<property name="eclipselink.logging.level.sql" value="FINE"/>
<property name="eclipselink.logging.parameters" value="true"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://url/tables" />
<property name="javax.persistence.jdbc.user" value="user" />
<property name="javax.persistence.jdbc.password" value="password" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
<property name="eclipselink.logging.level.connection" value="FINEST"/>
</properties>
</persistence-unit>
</persistence>
for the second i have add in my depedency
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.48</version>
</dependency>
and still got error like this one
Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named FastMatch
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:85)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at com.dxtr.Transaction.FastMatchTransaction.FastmatchTransaction.main(FastmatchTransaction.java:12)
and here my pom.xml
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.4.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.0</version>
</dependency>
i have try add javax.persistence.2.2.jar and other solution from other link here but this problem cannot run well
for more information i use mysql5.7 and eclipse for IDE. and for running this code i use aws. i have try all of the code in stackoverflow but still got the problem so how to fix it ?
fuad