org.jboss.as.server.deployment.DeploymentUnitProce

2019-09-03 02:31发布

问题:

I create simple app with PrimeFaces 3.4 and JSF 2.1. When I deploy the application in my JBoss AS 7.0, I encounter the following error

18:55:27,684 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "Getting-started-with-Primefaces.war"
18:55:29,480 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."Getting-started-with-Primefaces.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."Getting-started-with-Primefaces.war".PARSE: Failed to process phase PARSE of deployment "Getting-started-with-Primefaces.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [:1.7.0_79]
    at java.lang.Thread.run(Thread.java:745) [:1.7.0_79]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Failed to parse "/C:/Users/marcos/Downloads/jboss-as-web-7.0.2.Final/jboss-as-web-7.0.2.Final/standalone/deployments/Getting-started-with-Primefaces.war/WEB-INF/web.xml" at [6,1]
    at org.jboss.as.web.deployment.WebParsingDeploymentProcessor.deploy(WebParsingDeploymentProcessor.java:70)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
    ... 5 more

My pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.itcuties.examples.webapps.simplejsf</groupId>
  <artifactId>simple-jsf2-with-primefaces</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>simple-jsf2</name>
  <url>http://maven.apache.org</url>



  <dependencies>
    <!-- Primefaces -->  
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>3.4</version>
    </dependency>
    <!-- JSF 2 API -->
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.2.0-m07</version>
    </dependency>
  </dependencies>
  <repositories>
      <repository>
          <id>primefaces-repository</id>
          <name>Primefaces repository</name>
          <url>http://repository.primefaces.org</url>
      </repository>
  </repositories>
  <build>
    <finalName>jsf2</finalName>
    <plugins>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>
    </plugin>
    </plugins>

  </build>
</project>

Update: on request, my web.xml:

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
                        http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
                        version="3.0">
<web-app>
    <display-name>Simple JSF2 Application with Primefaces</display-name>

    <!-- 
        Current project stage. When it is set to 'Development' Primefaces give a lot of debug information on the screen.
     -->
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>

    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>

    <!-- Staring JSF -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- JSF URL mapping -->
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>

</web-app>

The problem in cause by, is in line [6,1] in the tag "web-app", but I do not understand.

Any idea what could be the problem?

回答1:

In case you're getting exceptions, always head to the bottommost "Caused by" part for the root cause of all the trouble.

Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Failed to parse "/C:/Users/marcos/Downloads/jboss-as-web-7.0.2.Final/jboss-as-web-7.0.2.Final/standalone/deployments/Getting-started-with-Primefaces.war/WEB-INF/web.xml" at [6,1]

You see, a good exception and message is usually already the whole answer at its own. The server choked while parsing the webapp's web.xml file at line 6 and character 1.

Your web.xml look like this:

1    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
2        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
4                            http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
5                            version="3.0">
6    <web-app>
7        <display-name>Simple JSF2 Application with Primefaces</display-name>
.
.        ...
.
.    </web-app>

At line 6 there's a duplicate <web-app> declaration. Get rid of it.



标签: jsf-2 web.xml