maven项目+ wildfly + deploy .war

时间:2016-02-29 14:41:28

标签: java maven java-ee jboss wildfly

注意:我是开发人员的Javaee新手。 我的问题似乎很简单,但我无法理解,我创建了一个简单的Maven项目,当我尝试在maven中构建它并编写" wildfly:deploy"我遇到了部署"" .war的问题,这是.log:

Services which failed to start:      service jboss.deployment.unit."pfeweb.war".component.AlimentationBD.START: org.jboss.msc.service.StartException in service jboss.deployment.unit."pfeweb.war".component.AlimentationBD.START: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance

15:26:18,891 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:19990/management
15:26:18,892 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:19990
15:26:18,892 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) started (with errors) in 15180ms - Started 362 of 540 services (5 services failed or missing dependencies, 221 services are lazy, passive or on-demand)
15:26:18,969 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 18) WFLYJPA0011: Stopping Persistence Unit (phase 2 of 2) Service 'pfeweb.war#pfe-ejb'
15:26:18,980 INFO  [org.jboss.weld.deployer] (MSC service thread 1-8) WFLYWELD0010: Stopping weld service for deployment pfeweb.war
15:26:18,981 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 18) WFLYJPA0011: Stopping Persistence Unit (phase 1 of 2) Service 'pfeweb.war#pfe-ejb'
15:26:19,051 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0028: Stopped deployment pfeweb.war (runtime-name: pfeweb.war) in 104ms
15:26:19,196 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0009: Undeployed "pfeweb.war" (runtime-name: "pfeweb.war")
15:26:19,198 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
WFLYCTL0184:    New missing/unsatisfied dependencies:
      service jboss.deployment.unit."pfeweb.war".WeldStartService (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./pfeweb, service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."pfeweb.war".component.AlimentationBD.START (missing) dependents: [service jboss.deployment.unit."pfeweb.war".moduleDeploymentRuntimeInformationStart, service jboss.deployment.unit."pfeweb.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./pfeweb, service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."pfeweb.war".component.AuthentificationService.START (missing) dependents: [service jboss.deployment.unit."pfeweb.war".moduleDeploymentRuntimeInformationStart, service jboss.deployment.unit."pfeweb.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./pfeweb, service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."pfeweb.war".component."Beans.AccessBean".START (missing) dependents: [service jboss.deployment.unit."pfeweb.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./pfeweb, service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."pfeweb.war".component."com.sun.faces.config.ConfigureListener".START (missing) dependents: [service jboss.deployment.unit."pfeweb.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./pfeweb, service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."pfeweb.war".component."javax.faces.webapp.FacetTag".START (missing) dependents: [service jboss.deployment.unit."pfeweb.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./pfeweb, service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."pfeweb.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START (missing) dependents: [service jboss.deployment.unit."pfeweb.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./pfeweb, service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."pfeweb.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START (missing) dependents: [service jboss.deployment.unit."pfeweb.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./pfeweb, service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."pfeweb.war".component."org.jboss.weld.servlet.WeldInitialListener".START (missing) dependents: [service jboss.deployment.unit."pfeweb.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./pfeweb, service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."pfeweb.war".component."org.jboss.weld.servlet.WeldTerminalListener".START (missing) dependents: [service jboss.deployment.unit."pfeweb.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./pfeweb, service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."pfeweb.war".ee.ComponentRegistry (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."pfeweb.war".moduleDeploymentRuntimeInformation (missing) dependents: [service jboss.deployment.unit."pfeweb.war".moduleDeploymentRuntimeInformationStart] 
      service jboss.persistenceunit."pfeweb.war#pfe-ejb" (missing) dependents: [service jboss.deployment.unit."pfeweb.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./pfeweb, service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService] 
      service jboss.server.global-request-controller.control-point."pfeweb.war".undertow (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService] 
      service jboss.undertow.deployment.default-server.default-host./pfeweb (missing) dependents: [service jboss.deployment.unit."pfeweb.war".deploymentCompleteService] 
      service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./pfeweb] 
      service jboss.undertow.deployment.default-server.default-host./pfeweb.codec (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService] 
      service jboss.undertow.deployment.default-server.default-host./pfeweb.session (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./pfeweb.UndertowDeploymentInfoService] 
WFLYCTL0186:   Services which failed to start:      service jboss.deployment.unit."pfeweb.war".component.AlimentationBD.START

15:26:23,416 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found pfeweb.war in deployment directory. To trigger deployment create a file called pfeweb.war.dodeploy

有人可以帮助我吗

2 个答案:

答案 0 :(得分:0)

This is pom.xml of the war project 
<modelVersion>4.0.0</modelVersion>
<groupId>tn.orange.pfe</groupId>
<artifactId>pfeweb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    <failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
<dependencies>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
    </dependency>
    <dependency>
        <groupId>tn.orange.pfe</groupId>
        <version>0.0.1-SNAPSHOT</version>
        <artifactId>pfeejb</artifactId>
        <type>ejb</type>
    </dependency>
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>5.2</version>
    </dependency>

</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-maven-plugin</artifactId>
            <version>1.0.2.Final</version>
            <configuration>
                <hostname>localhost</hostname>
                <port>18181</port>
                <finalName>${project.artifactId}</finalName>
            </configuration>
        </plugin>
        </plugins>
</build>

答案 1 :(得分:0)

很简单,你可能有一些冲突的API(特别是这里的javax.servlet-api)。

  

尝试通过更改pom.xml中的范围,提供的范围只会在编译时放置依赖关系,并且依赖关系不会在运行时发生冲突,Wildfly提供了默认的javax servlet依赖关系。 / p>

像:

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>3.1.0</version>
  <scope>provided</scope>
</dependency>   

这样,您提供的servlet api不会与服务器提供的那个冲突,并且只有在编译时才会出现依赖关系。
(P.S - 服务器也提供javax.servlet),如果您已经使用过maven install,只需从库中删除javax.servlet-api并再次执行maven install