Foren
No Persistence provider for EntityManager named X
Alberto Martínez, geändert vor 7 Jahren.
No Persistence provider for EntityManager named X
New Member Beiträge: 23 Beitrittsdatum: 04.12.15 Neueste Beiträge
Hi!!
I´m try to do a persist of a custom class but it seems that persistence.xml doesn´t work correctly
This is persistence.xml
And this is the call to createEntityManagerFactory
And the exception is the next one:
The portlet contains eclipselink.jar, hibernate-entitymanager-4.0.1.Final.jar, javax.persistence_2.1.1.v201509150925.jar and mysql-connector-java-5.1.4-bin.jar
Please, help!
I´m try to do a persist of a custom class but it seems that persistence.xml doesn´t work correctly
This is 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="FormularioPortlet">
<provider>
org.eclipse.persistence.jpa.PersistenceProvider
</provider>
<class>com.onetec.model.Demandante</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/curriculum" />
<property name="javax.persistence.jdbc.user" value="root" />
<property name="javax.persistence.jdbc.password" value="root" />
</properties>
</persistence-unit>
</persistence>
And this is the call to createEntityManagerFactory
EntityManagerFactory emf = Persistence.createEntityManagerFactory("FormularioPortlet");
EntityManager em = emf.createEntityManager();
Demandante d = new Demandante(mail, nombre);
em.getTransaction().begin();
em.persist(d);
em.getTransaction().commit();
And the exception is the next one:
16:04:44,093 ERROR [http-bio-8080-exec-15][render_portlet_jsp:132] null
javax.persistence.PersistenceException: No Persistence provider for EntityManager named FormularioPortlet
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:84)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at com.onetec.Formulario.addDemandante(Formulario.java:90)
at com.onetec.Formulario.addTask(Formulario.java:52)
at com.liferay.portal.kernel.portlet.LiferayPortlet.callActionMethod(LiferayPortlet.java:148)
at com.liferay.util.bridges.mvc.MVCPortlet.callActionMethod(MVCPortlet.java:247)
at com.liferay.portal.kernel.portlet.LiferayPortlet.processAction(LiferayPortlet.java:78)
at com.liferay.util.bridges.mvc.MVCPortlet.processAction(MVCPortlet.java:210)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:71)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605)
The portlet contains eclipselink.jar, hibernate-entitymanager-4.0.1.Final.jar, javax.persistence_2.1.1.v201509150925.jar and mysql-connector-java-5.1.4-bin.jar
Please, help!
Alberto Martínez, geändert vor 7 Jahren.
RE: No Persistence provider for EntityManager named X (Antwort)
New Member Beiträge: 23 Beitrittsdatum: 04.12.15 Neueste Beiträge
I solved that adding eclipselink.jar and javax.persistence_2.1.1.v201509150925.jar to lib folder in <approot>/WEBINF/lib
I hope this help
I hope this help