使用 maven、servlet、jsp 和 java 构建失败

Build failure using maven, servlet, jsp and java

我得到如下错误,有人帮我查问题。我正在使用 jsp、servelt wildfly 和 hibernate 开发一个 Maven 项目。该项目处于初始开发阶段。

13:13:15,694 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."KinaGroup.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."KinaGroup.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "KinaGroup.war"
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:163)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEJB0406: No EJB found with interface of type 'kina.member.bean.MemberBeanI' for binding kina.member.action.MemberAction/memberBean
        at org.jboss.as.ejb3.deployment.processors.EjbInjectionSource.getResourceValue(EjbInjectionSource.java:90)
        at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.addJndiBinding(ModuleJndiBindingProcessor.java:212)
        at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.handle(ModuleJndiBindingProcessor.java:183)
        at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
        at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:151)
        at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:144)
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:156)
        ... 5 more

    13:13:15,741 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 61) WFLYCTL0013: Operation ("redeploy") failed - address: ([("deployment" => "KinaGroup.war")]) - failure description: {
        "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"KinaGroup.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"KinaGroup.war\".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment \"KinaGroup.war\"
        Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEJB0406: No EJB found with interface of type 'kina.member.bean.MemberBeanI' for binding kina.member.action.MemberAction/memberBean"},
        "WFLYCTL0180: Services with missing/unavailable dependencies" => [
            "jboss.deployment.unit.\"KinaGroup.war\".batch.environment is missing [jboss.deployment.unit.\"KinaGroup.war\".beanmanager]",
            "jboss.deployment.unit.\"KinaGroup.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"KinaGroup.war\".beanmanager]"
        ]
    }
    13:13:15,743 ERROR [org.jboss.as.server] (management-handler-thread - 61) WFLYSRV0011: Redeploy of deployment "KinaGroup.war" was rolled back with the following failure message: 
    {
        "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"KinaGroup.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"KinaGroup.war\".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment \"KinaGroup.war\"
        Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEJB0406: No EJB found with interface of type 'kina.member.bean.MemberBeanI' for binding kina.member.action.MemberAction/memberBean"},
        "WFLYCTL0180: Services with missing/unavailable dependencies" => [
            "jboss.deployment.unit.\"KinaGroup.war\".batch.environment is missing [jboss.deployment.unit.\"KinaGroup.war\".beanmanager]",
            "jboss.deployment.unit.\"KinaGroup.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"KinaGroup.war\".beanmanager]"
        ]
    }
    13:13:15,743 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 203) WFLYJPA0011: Stopping Persistence Unit (phase 1 of 2) Service 'KinaGroup.war#primary'
    13:13:15,758 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0028: Stopped deployment KinaGroup.war (runtime-name: KinaGroup.war) in 15ms
    13:13:15,760 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 61) WFLYCTL0190: Step handler org.jboss.as.server.deployment.DeploymentHandlerUtil@76005c00 for operation {"operation" => "full-replace-deployment","address" => [],"name" => "KinaGroup.war","runtime-name" => "KinaGroup.war","content" => [{"input-stream-index" => 0}],"operation-headers" => {"caller-type" => "user","access-mechanism" => "NATIVE"},"enabled" => undefined,"persistent" => true,"owner" => undefined} at address [] failed handling operation rollback -- java.util.NoSuchElementException: No child 'name' exists: java.util.NoSuchElementException: No child 'name' exists
        at org.jboss.dmr.ModelValue.requireChild(ModelValue.java:377)
        at org.jboss.dmr.ObjectModelValue.requireChild(ObjectModelValue.java:299)
        at org.jboss.dmr.ModelNode.require(ModelNode.java:870)
        at org.jboss.as.server.deployment.DeploymentHandlerUtil.handleResult(DeploymentHandlerUtil.java:259)
        at org.jboss.as.controller.AbstractOperationContext$Step.invokeResultHandler(AbstractOperationContext.java:1401)
        at org.jboss.as.controller.AbstractOperationContext$Step.handleResult(AbstractOperationContext.java:1381)
        at org.jboss.as.controller.AbstractOperationContext$Step.finalizeInternal(AbstractOperationContext.java:1332)
        at org.jboss.as.controller.AbstractOperationContext$Step.finalizeStep(AbstractOperationContext.java:1307)
        at org.jboss.as.controller.AbstractOperationContext$Step.access0(AbstractOperationContext.java:1180)
        at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:621)
        at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:354)
        at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:330)
        at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1183)
        at org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:362)
        at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:218)
        at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.doExecute(ModelControllerClientOperationHandler.java:201)
        at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.access0(ModelControllerClientOperationHandler.java:128)
        at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.run(ModelControllerClientOperationHandler.java:150)
        at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.run(ModelControllerClientOperationHandler.java:146)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:422)
        at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:92)
        at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.execute(ModelControllerClientOperationHandler.java:146)
        at org.jboss.as.protocol.mgmt.AbstractMessageHandler.doExecute(AbstractMessageHandler.java:298)
        at org.jboss.as.protocol.mgmt.AbstractMessageHandler$AsyncTaskRunner.run(AbstractMessageHandler.java:518)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
        at org.jboss.threads.JBossThread.run(JBossThread.java:320)

//My bean look like this
package kina.member.bean;

import java.util.List;

import javax.inject.Inject;

import kina.member.dao.MemberDaoI;
import kina.member.model.Member;

public class MemberBean implements MemberBeanI{

    @Inject
    private MemberDaoI memberDao;

    public void add(Member member) {
        // TODO Auto-generated method stub

    }

    public List<Member> list() {
        // TODO Auto-generated method stub
        return null;
    }

}

//这是用我的 bean 实现的接口

package kina.member.bean;

import java.util.List;

import kina.member.model.Member;

public interface MemberBeanI {

    void add(Member member);

    List<Member> list();

}

//这是我的道

package kina.member.dao;

import java.util.List;

import kina.member.model.Member;

public class MemberDao implements MemberDaoI{

    public Member add(Member member) {
        // TODO Auto-generated method stub
        return null;
    }

    public Member load(Member member) {
        // TODO Auto-generated method stub
        return null;
    }

    public List<Member> list(Member filter) {
        // TODO Auto-generated method stub
        return null;
    }

    public void delete(Long memberId) {
        // TODO Auto-generated method stub

    }

}

//我的dao界面是这样的

package kina.member.dao;

import java.util.List;

import kina.member.model.Member;

public interface MemberDaoI {

    Member add(Member member);

    Member load(Member member);

    List<Member> list(Member filter);

    void delete(Long memberId);

}

//我的模型是这样的

package kina.member.model;

import javax.annotation.Generated;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "memb_members")
public class Member {

    @Id@GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "name")
    private String name;

    @Column(name = "national_id")
    private Long memberId;

    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Long getMemberId() {
        return memberId;
    }
    public void setMemberId(Long nationalId) {
        this.memberId = nationalId;
    }



}

//我有persistence.xml这样

<persistence 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"
             version="2.0">
   <persistence-unit name="primary" transaction-type="JTA">
      <jta-data-source>java:jboss/datasources/KinaGroupDS</jta-data-source>
      <properties>

        <!-- Database connection settings -->
        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
        <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
        <property name="hibernate.archive.autodetection" value="class, hbm" />

        <!-- Disable second-level cache. -->
        <property name="cache.provider_class" value="org.hibernate.cache.NoCacheProvider" />
        <property name="cache.use_query_cache" value="false" />
        <property name="cache.use_minimal_puts" value="false" />

        <!-- Print SQL to stdout. -->
        <property name="show_sql" value="true" />
        <property name="format_sql" value="true" />

        <!-- update schema on SessionFactory build -->
        <property name="hibernate.hbm2ddl.auto" value="update" />

      </properties>
   </persistence-unit>
</persistence>

我的 standalone.xml 看起来像这样。我在哪里定义了我的数据源

jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=假 h2 萨 萨 jdbc:mysql://localhost:3306/trip_ticket?useSSL=false mysql 根 sam123#@! jdbc:mysql://localhost:3306/kina_group?useSSL=false mysql 根 sam123#@! 组织h2.jdbcx.JdbcDataSource com.mysql.jdbc.Driver

wildfly 错误日志表明您部署的应用程序中可能存在错误。请解决错误并再次尝试部署应用程序。我建议在部署之前重新启动 wildfly 以进行检查。

尝试将 bean 的实现注入到 Servlet 中。或者,如果您已完成上一步,则导入 bean 实现的包。