首页 文章

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

提问于
浏览
0

我正在创建一个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 \” . 安装“:”org.jboss.msc.service.StartException in service jboss.deployment.subunit . \“DebitoAutomaticoMock-ear.ear \” . \“DebitoAutomaticoMock-ejb.jar \ “.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有错误:\ nJBAS011440:在部署的“DebitoAutomaticoMock-ejb.jar”的子部署中找不到名为DebitoAutomaticoMockDS的持久性单元DebitoAutomaticoMock-ear.ear \“”},“JBAS014771:缺少/不可用依赖的服务”:[“jboss.naming.context.java.c omp.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 \“ . component . \”javax.faces.webapp.FacetTag \“.START遗失[jboss.persistenceunit . \”DebitoAutomaticoMock-ear.ear / DebitoAutomaticoMock-ejb.jar #primary \ “]”,“jboss.naming.context.java.comp.DebitoAutomaticoMock-ear.DebitoAutomaticoMock-ejb.MemberRegistration.ValidatorFactory缺失[jboss.naming.context.java.comp.DebitoAutomaticoMock-ear.DebitoAutomaticoMock-ejb.MemberRegistration]” ,“jboss.naming.context.java.module.DebitoAutomaticoMock-ear.DebitoAutomaticoMock-web.D缺少efaultDataSource [jboss.naming.context.java.jboss.datasources.WebServicesDS]“,”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 \” . 组件 . \“javax.servlet.jsp.jstl.tlv.ScriptFreeTLV \”.START遗失[jboss.persistenceunit . \“DebitoAutomaticoMock-ear.ear / DebitoAutomaticoMock-ejb.jar# primary \“]”,“jboss.deployment.subunit . \”DebitoAutomaticoMock-ear.ear \“ . \”DebitoAutomaticoMock-web.war \“ . component . \”bo.com.sintesis.debito.mock.Servicios \“ .START缺失[jboss.persistenceunit . \“DebitoAutomaticoMock-ear.ear / DebitoAutomaticoMock-ejb.jar#primary \”]“,”jboss.deployment.unit . \“DebitoAutomaticoMock-ear.ear \” . deploymentCompleteService缺失[ jboss.deployment.subunit . \ “DebitoAutomaticoMock-ear.ear \” \“德bitoAutomaticoMock-ejb.jar \“ . deploymentCompleteService”“,”jboss.deployment.subunit . \“DebitoAutomaticoMock-ear.ear \” . \“DebitoAutomaticoMock-web.war \” . component . \“bo.com.sintesis.debito .bancos.ServicioDebito \“ . START缺失[jboss.persistenceunit . \”DebitoAutomaticoMock-ear.ear / DebitoAutomaticoMock-ejb.jar#primary \“]”,“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 \” . 星T缺失了[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 \” . 组件 . \“javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV \” . START缺失[jboss.persistenceunit . \“DebitoAutomaticoMock-ear.ear / DebitoAutomaticoMock-ejb.jar #primary \”]“,”jboss.deployment.subunit . \“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 . \ “DebitoAutomaticoMock-ear.ear \” \ “DebitoAutomaticoMock-的web.war \” . COMPON ent . \“com.sun.xml.ws.transport.http.servlet.WSAsyncListener $ 1 \” . 缺少START [jboss.persistenceunit . \“DebitoAutomaticoMock-ear.ear / DebitoAutomaticoMock-ejb.jar #primary \”]“ ]},“roll-back”: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

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

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

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

相关问题