Then I'm trying to use Eclipse link ORM with a Bukkit plugin.
I know that an ORM has already been made in Craftbookkit (EBIN) but it does not match my needs; it is very limited for organizations. This is the reason why I turn on EclipseLink.
The problem is that I can not start an EntityManagerFactory inside my bookcase plugin: It seems that the JPA inside my plugin jar is meta-INF / firmness. XM can not be found. I think this is a classpath problem, and JApa has tried to find a firm file using Craftbookkit square foot instead of my plugin classpath, but I do not know how to solve it.
Here my main plugin is:
Increases the public class MyPlugin JavaPlugin {@Override Public Nuts} Enabled () {EntityManagerFactory factory = Strength .createEntityManagerFactory ( "Persistunit"); EntityManager em = factory.createEntityManager (); // ...} // ...}
and my persistence.xml file (which is located in the Meta-INF folder of my plugin jar):
< Previous> & lt ;? XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Persistence version = "2.1" xmlns = "http://xmlns.jcp.org/xml/ns/produstence" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" XSI: Schema Locations = "Http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> & Lt; Persistent-entity name = "persistunit" transaction-type = "RESOURCE_LOCAL" & gt; & Lt; Provider & gt; Org.eclipse.persistence.jpa.PersistenceProvider & lt; / Provider & gt; & Lt; Properties & gt; & Lt; Property Name = "javax.persistence.jdbc.url" value = "jdbc: mysql: // ......" /> & Lt; Property Name = "javax.persistence.jdbc.user" value = "......." /> & Lt; Property Name = "javax.persistence.jdbc.driver" value = "com.mysql.jdbc.Driver" /> & Lt; Property Name = "javax.persistence.jdbc.password" value = "........." /> & Lt; / Properties & gt; & Lt; / Persistence unit & gt; & Lt; / Persistence>
And when that exception is occurring:
Error occurred while activating MyPlugin ... javax.persistence.PersistenceException: named EntityManager persistunit For any persistent provider at javax.persistence.Persistence.createEntityManagerFactory (Persistence.java:89) ~ [craftbukkit.jar: Git-Kid-1.7.9- R0.2-205-g0a049fa] javax.persistence.Persistence CreateEntityManagerFactory (at Persistence.java: 60) ~ [craftbukkit.jar: git-water-tomorrow-1.7.9-R0.2-205-g0a049fa]!
Thank you in advance for your help
Comments
Post a Comment