I have an issue with a Java program. When I run the program from Eclipse (Run or Debug) it works fine. But, when I try to run the exported JAR file it gives me the following error:
977 INFO [main] openjpa.Runtime - Starting OpenJPA 2.4.2 The persistence provider is attempting to use properties in the persistence.xml file to resolve the data source. A Java Database Connectivity (JDBC) driver or data source class name must be specified in the openjpa.ConnectionDriverName or javax.persistence.jdbc.driver property. The following properties are available in the configuration: "org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@2655aabb".
I checked that the persistence.xml is in the correct place (src/META-INF) in the JAR file.
This is my persistence.xml:
<persistence-unit name="JPA" transaction-type="RESOURCE_LOCAL">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<class>class_name_here</class>
<class>class_name_here</class>
<properties>
<property name="openjpa.RuntimeUnenhancedClasses" value="unsupported" />
<!-- Production -->
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://server:port/database" />
<property name="javax.persistence.jdbc.user" value="user" />
<property name="javax.persistence.jdbc.password" value="password" />
</properties>
*I removed the values from the properties, but in the original file they are there and they are correct (it runs from within Eclipse).