在WildFly 8中部署EAR应用程序的问题,无法找到持久性UNIT

时间:2015-05-13 18:53:35

标签: jpa wildfly-8

我正在创建Java EE / 7 EAR应用程序,并且作为目标AS使用WildFly 8.2。我首先注意到的是我的ds.xml文件没有在服务器中定义任何DS,我必须手动创建它。注入EntityManage的第二个类具有以下注释:

@PersistenceContext(unitName = "DebitoAutomaticoMockDS")
private EntityManager em;

但在此之后,部署WildFly时仍然会出现以下错误:

  

部署失败:DebitoAutomaticoMock-ear.ear:{"结果" :"失败","失败 - 描述" :{" JBAS014671:服务失败" :{" jboss.deployment.subunit。\" DebitoAutomaticoMock-ear.ear \"。\" DebitoAutomaticoMock-ejb.jar \" .INSTALL" :" org.jboss.msc.service.StartException in service jboss.deployment.subunit。\" DebitoAutomaticoMock-ear.ear \"。\" DebitoAutomaticoMock-ejb.jar \& #34; .INSTALL:JBAS018733:无法处理子部署的阶段INSTALL \" DebitoAutomaticoMock-ejb.jar \"部署\" DebitoAutomaticoMock-ear.ear \" \ n引起:org.jboss.as.server.deployment.DeploymentUnitProcessingException:JBAS011047:组件类bo.com.sintesis.debito.mock.service。组件MemberRegistration的MemberRegistration有错误:\ n \ nJBAS011440:在子部署中找不到名为DebitoAutomaticoMockDS的持久性单元\#34; DebitoAutomaticoMock-ejb.jar \"部署\" DebitoAutomaticoMock-ear.ear \""}," JBAS014771:具有丢失/不可用依赖关系的服务" :[" jboss.naming.context.java.comp.DebitoAutomaticoMock-ear.DebitoAutomaticoMock-ejb.MemberRegistration.InAppClientContainer缺失[jboss.naming.context.java.comp.DebitoAutomaticoMock-ear.DebitoAutomaticoMock-ejb.MemberRegistration] "," jboss.naming.context.java.comp.DebitoAutomaticoMock-ear.DebitoAutomaticoMock-ejb.MemberRegistration.Validator缺失[jboss.naming.context.java.comp.DebitoAutomaticoMock-ear.DebitoAutomaticoMock-ejb .MemberRegistration]"," jboss.deployment.subunit。\" DebitoAutomaticoMock-ear.ear \"。\" DebitoAutomaticoMock-web.war \"。组件。\" javax.faces.webapp.FacetTag \" .START缺失[jboss.persistenceunit。\" DebitoAutomaticoMock-ear.ear / DebitoAutomaticoMock-ejb.jar#primary \&#34 ;]"," jboss.naming.context.java.comp.DebitoAutomaticoMock-ear.DebitoAutomaticoMock-ejb.MemberRegistration.ValidatorFactory缺失[jboss.naming.context.java.comp.DebitoAutomaticoMock-ear.DebitoAutomaticoMock -ejb.MemberRegistrat离开]"," jboss.naming.context.java.module.DebitoAutomaticoMock-ear.DebitoAutomaticoMock-web.DefaultDataSource缺失[jboss.naming.context.java.jboss.datasources.WebServicesDS]&#34 ;," jboss.deployment.subunit。\" DebitoAutomaticoMock-ear.ear \"。\" DebitoAutomaticoMock-ejb.jar \" .weld.weldClassIntrospector缺失[ jboss.deployment.subunit。\" DebitoAutomaticoMock-ear.ear \"。\" DebitoAutomaticoMock-ejb.jar \" .beanmanager]"," jboss 。.deployment.subunit \" DebitoAutomaticoMock-ear.ear \" \" DebitoAutomaticoMock-web.war中\" .component \" javax.servlet.jsp。 jstl.tlv.ScriptFreeTLV \" .START缺失[jboss.persistenceunit。\" DebitoAutomaticoMock-ear.ear / DebitoAutomaticoMock-ejb.jar#primary \"]",&# 34。jboss.deployment.subunit \" DebitoAutomaticoMock-ear.ear \" \" DebitoAutomaticoMock-web.war中\" .component \" bo.com .sintesis.debito.mock.Servicios \" .START缺失[jboss.persistenceunit。\" DebitoAutom aticoMock-ear.ear / DebitoAutomaticoMock-ejb.jar#primary \"]"," jboss.deployment.unit。\" DebitoAutomaticoMock-ear.ear \"。缺少deploymentCompleteService [jboss.deployment.subunit。\" DebitoAutomaticoMock-ear.ear \"。\" DebitoAutomaticoMock-ejb.jar \" .deploymentCompleteService]",& #34; jboss.deployment.subunit \" DebitoAutomaticoMock-ear.ear \" \" DebitoAutomaticoMock-web.war中\" .component \"博。 com.sintesis.debito.bancos.ServicioDebito \" .START缺失[jboss.persistenceunit。\" DebitoAutomaticoMock-ear.ear / DebitoAutomaticoMock-ejb.jar#primary \"]&#34 ;," jboss.naming.context.java.comp.DebitoAutomaticoMock-ear.DebitoAutomaticoMock-ejb.MemberRegistration.InstanceName缺失[jboss.naming.context.java.comp.DebitoAutomaticoMock-ear.DebitoAutomaticoMock-ejb.MemberRegistration] "," jboss.deployment.unit。\" DebitoAutomaticoMock-ear.ear \" .WeldStartService缺失[jboss.persistenceunit。\" DebitoAutomaticoMock -ear.ear / DebitoAutomaticoMock-ejb.jar#primary \",jboss.deployment.subunit。\" DebitoAutomaticoMock-ear.ear \"。\" DebitoAutomaticoMock-ejb.jar \" .jndiDependencyService]"," jboss.deployment.subunit。\" DebitoAutomaticoMock-ear.ear \"。\" DebitoAutomaticoMock-web.war \ " .component。\" bo.com.sintesis.debito.bancos.ServiciosBanco \" .START缺失[jboss.persistenceunit。\" DebitoAutomaticoMock-ear.ear / DebitoAutomaticoMock- ejb.jar#primary \"]"," jboss.deployment.subunit。\" DebitoAutomaticoMock-ear.ear \"。\" DebitoAutomaticoMock-web .war \" .component。\" com.sun.xml.ws.transport.http.servlet.WSServletContextListener \" .START缺失[jboss.persistenceunit。\" DebitoAutomaticoMock -ear.ear / DebitoAutomaticoMock-ejb.jar#primary \"]"," jboss.deployment.subunit。\" DebitoAutomaticoMock-ear.ear \"。\ " DebitoAutomaticoMock-web.war中\" .component \" javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV \" .STAR缺少T [jboss.persistenceunit。\" DebitoAutomaticoMock-ear.ear / DebitoAutomaticoMock-ejb.jar#primary \"]"," jboss.deployment.subunit。\&# 34; DebitoAutomaticoMock-ear.ear \" \" DebitoAutomaticoMock-web.war中\" .component \" com.sun.faces.config.ConfigureListener \" .START缺失[jboss.persistenceunit。\" DebitoAutomaticoMock-ear.ear / DebitoAutomaticoMock-ejb.jar#primary \"]"," jboss.deployment.subunit。\& #34; DebitoAutomaticoMock-ear.ear \" \" DebitoAutomaticoMock-web.war中\" .component \" com.sun.xml.ws.transport.http.servlet .WSAsyncListener $ 1 \" .START缺失[jboss.persistenceunit。\" DebitoAutomaticoMock-ear.ear / DebitoAutomaticoMock-ejb.jar#primary \"]" ]},"回滚" :true}

我很困惑,因为我的持久性单位如下:

<persistence version="2.0"
   xmlns="http://java.sun.com/xml/ns/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">
   <persistence-unit name="primary">
      <!-- If you are running in a production environment, add a managed 
         data source, this example data source is just for development and testing! -->
      <!-- The datasource is deployed as <EAR>/META-INF/DebitoAutomaticoMock-ds.xml, you
         can find it in the source at ear/src/main/application/META-INF/DebitoAutomaticoMock-ds.xml -->
      <jta-data-source>java:jboss/datasources/DebitoAutomaticoMockDS</jta-data-source>
      <properties>
         <!-- Properties for Hibernate -->
         <property name="hibernate.hbm2ddl.auto" value="create-drop" />
         <property name="hibernate.show_sql" value="false" />
      </properties>
   </persistence-unit>
</persistence>

请给我一些提示,我真的无法找到问题。

1 个答案:

答案 0 :(得分:0)

@PersistenceContext(unitName =“”)中的unitName应与<persistence-unit name="primary">中定义的相同

在你的情况下它是“主要”而不是“DebitoAutomaticoMockDS”。

解决方案: @PersistenceContext(unitName =“primary”)

相关问题