java - why getting “No Persistence provider for EntityManager” when running with jnlp while standalone jar works fine -
environment win 8.1 mysql server: localhost netbeans 7.4 java: 1.7.0_51 (j2se) jre: 1.7.0_51-b31 eclipselink(jpa 2.1)
there several posts asking “no persistence provider entitymanager named…” error. developing j2se (not j2ee). however, problems seem silly troubles me 2days. need other software standalone program work? why oaky when run program under netbeans ide? sort of environment setting issue failed try?
working snapshot , eclipselink message!
i use netbeans write code, , runs okay. now, decided copy whole standalone package out “d:\netbeanswork\projcosttracking\dist”. have change security setting medium in java control panel. then, double-clicked on projcosttracking.jnlp launch. well, see.
this 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="projcosttrackingpu" transaction-type="resource_local"> <provider>org.eclipse.persistence.jpa.persistenceprovider</provider> <class>projcosttracking.entityuserlevel</class> <class>projcosttracking.entityuser</class> <properties> <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/biotechcost?zerodatetimebehavior=converttonull"/> <property name="javax.persistence.jdbc.password" value="1234"/> <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.driver"/> <property name="javax.persistence.jdbc.user" value="root"/> </properties> </persistence-unit> </persistence>
the entity files
the generated files , lib
as persistence.xml, copy 3 places make sure can “seen”.
as classpath, copied required jar files (from projcosttracking\dist\lib) lib folder under default jdk , jre. java suppose see jars.
usually connector issue. seems eclipse not using right connector. check connector version. should match version of mysql database.
Comments
Post a Comment