[英]Using EJB to persist. How do I configure the Persistence Unit on it?
I've been learning about J2EE tech. 我一直在学习J2EE技术。 Now I'm trying to out my CRUD in a EJB, but when I try to deploy my web application, I have these problems.
现在,我正在尝试在EJB中开发CRUD,但是当我尝试部署Web应用程序时,出现了这些问题。 I don't have a clue about this one.
我对此一无所知。 Can you give me some tips about it?
你能给我一些提示吗?
This is my actual persistence.xml: 这是我实际的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="UsuarioPU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>LP3</jta-data-source>
<class>mack.entities.UsuarioImpl</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:derby://localhost:1527/LP3"/>
<property name="javax.persistence.jdbc.user" value="lp3"/>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/>
<property name="javax.persistence.jdbc.password" value="lp3"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
</properties>
</persistence-unit>
</persistence>
And this is the WildFly error when I try to deploy my application: 这是我尝试部署应用程序时的WildFly错误:
12:26:09,070 INFO [org.jboss.weld.deployer] (MSC service thread 1-6) JBAS016002: Processing weld deployment Atividade_1.war
12:26:09,285 ERROR [org.jboss.as.controller.management-operation] (XNIO-1 task-2) JBAS014613: Operation ("add") failed - address: ([{"deployment" => "Atividade_2Enterprise.ear"}]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => [
"jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean.ValidatorFactory is missing [jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean]",
"jboss.deployment.unit.\"Atividade_2Enterprise.ear\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"Atividade_2Enterprise.ear\".beanmanager]",
"jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean.InAppClientContainer is missing [jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean]",
"jboss.deployment.subunit.\"Atividade_2Enterprise.ear\".\"Atividade_2EJB.jar\".weld.weldClassIntrospector is missing [jboss.deployment.subunit.\"Atividade_2Enterprise.ear\".\"Atividade_2EJB.jar\".beanmanager]",
"jboss.persistenceunit.\"Atividade_2Enterprise.ear/EJBPersistencia.jar#UsuarioPU\".__FIRST_PHASE__ is missing [jboss.naming.context.java.LP3]",
"jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean.Validator is missing [jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean]",
"jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean.InstanceName is missing [jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean]"
]}
12:26:09,367 ERROR [org.jboss.as.server] (XNIO-1 task-2) JBAS015870: Deploy of deployment "Atividade_2Enterprise.ear" was rolled back with the following failure message:
{"JBAS014771: Services with missing/unavailable dependencies" => [
"jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean.ValidatorFactory is missing [jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean]",
"jboss.deployment.unit.\"Atividade_2Enterprise.ear\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"Atividade_2Enterprise.ear\".beanmanager]",
"jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean.InAppClientContainer is missing [jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean]",
"jboss.deployment.subunit.\"Atividade_2Enterprise.ear\".\"Atividade_2EJB.jar\".weld.weldClassIntrospector is missing [jboss.deployment.subunit.\"Atividade_2Enterprise.ear\".\"Atividade_2EJB.jar\".beanmanager]",
"jboss.persistenceunit.\"Atividade_2Enterprise.ear/EJBPersistencia.jar#UsuarioPU\".__FIRST_PHASE__ is missing [jboss.naming.context.java.LP3]",
"jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean.Validator is missing [jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean]",
"jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean.InstanceName is missing [jboss.naming.context.java.comp.Atividade_2Enterprise.Atividade_2EJB.Atividade_2Bean]"
]}
12:26:09,398 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015974: Stopped subdeployment (runtime-name: EJBPersistencia.jar) in 35ms
12:26:09,396 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015974: Stopped subdeployment (runtime-name: Atividade_2EJB.jar) in 33ms
12:26:09,647 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015974: Stopped subdeployment (runtime-name: Atividade_1.war) in 285ms
12:26:09,785 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment Atividade_2Enterprise.ear (runtime-name: Atividade_2Enterprise.ear) in 423ms
Thank you guys! 感谢大伙们!
RedFIVE, thanks for your attention! RedFIVE,谢谢您的关注! I'm was talking with my teacher, and he remembered me about the problem that NETBeans has with the Hibernate JPA.
我正在和我的老师谈话,他记得我关于NETBeans在Hibernate JPA中遇到的问题。 So I've tried changing for EclpiseLink provider, and ran it on GlassingFish server.
因此,我尝试更改EclpiseLink提供程序,并在GlassingFish服务器上运行它。 It FINALLY WORKED!
最终完成了!
Thanks once more! 再次感谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.