No Persistence Provider for Entitymanager named sample

Asked

Viewed 142 times

1

When I use the application in Eclipse, with tomcat8 it runs smoothly, then I run the package using Maven and deploy it in tomcat8 outside the eclipse and get the error below. Jars are coming from Maven and saved in WEB-INF/lib folder.

18-Feb-2017 17:10:52.957 GRAVE [http-nio-8080-exec-7] org.primefaces.application.exceptionhandler.Primeexceptionhandler.logException No Persistence Provider for Entitymanager named Sistafpu javax.persistence.Persistenceexception: No Persistence Provider for Entitymanager named Sistafpu at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:61) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39) at br.mil.Eb.sistaf.util.jpa.Entitymanagerproducer.(Entitymanagerproducer.java:18) at sun.reflect.Nativeconstructoraccessorimpl.newInstance0(Native Method) at sun.reflect.Nativeconstructoraccessorimpl.newInstance(Nativeconstructoraccessorimpl.java:62) at sun.reflect.Delegatingconstructoraccessorimpl.newInstance(Delegatingconstructoraccessorimpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.jboss.Weld.injection.Constructorinjectionpoint.newInstance(Constructorinjectionpoint.java:119) at org.jboss.Weld.injection.Constructorinjectionpoint.invokeAroundConstructCallbacks(Constructorinjectionpoint.java:92) at org.jboss.Weld.injection.Constructorinjectionpoint.newInstance(Constructorinjectionpoint.java:78) at org.jboss.Weld.injection.Producer.AbstractInstantiator.newInstance(Abstractinstantiator.java:28) at org.jboss.Weld.injection.Producer.BasicInjectionTarget.Produce(Basicinjectiontarget.java:116) at org.jboss.Weld.injection.Producer.BeanInjectionTarget.Produce(Beaninjectiontarget.java:175) at org.jboss.Weld.bean.Managedbean.create(Managedbean.java:158) at org.jboss.Weld.context.Abstractcontext.get(Abstractcontext.java:96) at org.jboss.Weld.manager.Beanmanagerimpl.getReference(Beanmanagerimpl.java:744) at org.jboss.Weld.injection.Producer.AbstractMemberProducer.getReceiver(Abstractmemberproducer.java:128) at org.jboss.Weld.injection.Producer.AbstractMemberProducer.Produce(Abstractmemberproducer.java:148) at org.jboss.Weld.bean.Abstractproducerbean.create(Abstractproducerbean.java:183) at org.jboss.Weld.context.Abstractcontext.get(Abstractcontext.java:96) at org.jboss.Weld.bean.proxy.ContextBeanInstance.getInstance(Contextbeaninstance.java:98) at org.jboss.Weld.bean.proxy.CachedBeanInstance.getInstance(Cachedbeaninstance.java:66) at org.jboss.Weld.bean.proxy.ProxyMethodHandler.invoke(Proxymethodhandler.java:99) at org.jboss.weld.proxies.AutoCloseable$EntityManager$HibernateEntityManager$QueryProducer$Serializable$Session$SharedSessionContract$1573548027$Proxy$_$$Weldclientproxy.unwrap(Unknown Source) at br.mil.Eb.sistaf.Repository.Militares.filtrados(Military.java:60) at br.mil.Eb.sistaf.Repository.Militares$Proxy$$$_Weldsubclass.filtrados(Unknown Source) at br.mil.Eb.sistaf.controller.PesquisaMilitaresBean.search(Pesquisamilitaresbean.java:53) at sun.reflect.Nativemethodaccessorimpl.invoke0(Native Method) at sun.reflect..Nativemethodaccessorimpl.invoke(Nativemethodaccessorimpl.java:62) at sun.reflect.Delegatingmethodaccessorimpl.invoke(Delegatingmethodaccessorimpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.el.parser.Astvalue.invoke(Astvalue.java:247) at org.apache.el.MethodExpressionImpl.invoke(Methodexpressionimpl.java:267) at org.jboss.Weld.util.el.ForwardingMethodExpression.invoke(Forwardingmethodexpression.java:40) at org.jboss.Weld.el.Weldmethodexpression.invoke(Weldmethodexpression.java:50) at com.sun.faces.facelets.el.TagMethodExpression.invoke(Tagmethodexpression.java:105) at com.sun.faces.facelets.tag.jsf.core.DeclarativeSystemEventListener.processEvent(Eventhandler.java:128) at javax.faces.Component.Uicomponent$Componentsystemeventlisteneradapter.processEvent(Uicomponent.java:2584) at javax.faces.Event.SystemEvent.processListener(Systemevent.java:108) at javax.faces.Event.ComponentSystemEvent.processListener(Componentsystemevent.java:118) with.sun.faces.application.Applicationimpl.processListeners(Applicationimpl.java:2169) with.sun.faces.application.Applicationimpl.invokeComponentListenersFor(Applicationimpl.java:2114) with.sun.faces.application.Applicationimpl.publishEvent(Applicationimpl.java:287) with.sun.faces.application.Applicationimpl.publishEvent(Applicationimpl.java:245) at javax.faces.application.ApplicationWrapper.publishEvent(Applicationwrapper.java:726))

my 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">


	<!-- Apache Derby -->
	<persistence-unit name="SistafPU">
	        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
	        
	
	        <properties>
	        	<property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect" />
	            <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
	            <property name="javax.persistence.jdbc.url" value="jdbc:derby:/home/melquiades/SistafDB;create=true" />
	            <property name="javax.persistence.jdbc.user" value="melquiades" />
	            <property name="javax.persistence.jdbc.password" value="melquiades" />
	            <property name="hibernate.show_sql" value="true" />
	            <property name="format_sql" value="true" />
	            <property name="hibernate.connection.charSet" value="UTF-8" />
	            <property name="hibernate.hbm2ddl.auto" value="update" />
	            
	            
			
	        </properties>
	</persistence-unit>
	

</persistence>

I’m already two days trying to solve this, I tried to put the jars of Hibernate straight in the folder, I already switched META-INF to the scr folder, I finally could not solve. Any north already helps, I’m beginner in these technologies and do not know where else to run.

ps. the Tomcat I use in the eclipse is the same as the one outside. ps2. I’ve seen many of these topics here on stackoverflow but none of them solved my problem

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.