Note that there are some explanatory texts on larger screens.

plurals
  1. PONo Persistence provider for EntityManager named ws-persist
    text
    copied!<p>I'm building a JAX-RS web service (Jersey) and now I'm trying to start using JPA. I have selected eclipselink to manage this persistence. </p> <p>To start off, I'm writing some junit test cases until I figure out how everything will come together. </p> <p>In my persistence.xml (WEB-INF/persistence.xml) I have:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;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" version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"&gt; &lt;persistence-unit name="ws-persist" transaction-type="RESOURCE_LOCAL"&gt; &lt;class&gt;beans.Change&lt;/class&gt; &lt;properties&gt; &lt;property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" /&gt; &lt;property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3333/tomcat" /&gt; &lt;property name="javax.persistence.jdbc.user" value="tomcat" /&gt; &lt;property name="javax.persistence.jdbc.password" value="...." /&gt; &lt;property name="eclipselink.ddl-generation" value="create-tables" /&gt; &lt;property name="eclipselink.ddl-generation.output-mode" value="database" /&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; </code></pre> <p></p> <p>In my test class I have.</p> <pre><code>public class PersistenceTests { private EntityManager em = null; @Before public void setUp() throws Exception { Properties propertiesMap = new Properties(); propertiesMap.put(PersistenceUnitProperties.DDL_GENERATION, PersistenceUnitProperties.DROP_AND_CREATE); EntityManagerFactory factory = Persistence.createEntityManagerFactory("ws-persist", propertiesMap); em = factory.createEntityManager(); } @After public void tearDown() throws Exception { } @Test public void testSetUp(){ Assert.assertNotNull("Entity manager was null", em); Assert.assertTrue("Entity manager wasn't connected", em.isOpen()); } } </code></pre> <p>I have eclipselink.jar, and two javax.persistence_*.jars under my WEB-INF/lib folder. I'm getting the exception metioned in the title, can someone please help me figure out how to fix this? </p> <p>Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload