从Eclipse部署到Glassfish Application Server时出现JSF2错误

时间:2013-05-13 10:37:20

标签: java eclipse java-ee jsf-2 glassfish

大家好我正在尝试运行我的jsf2应用程序,一切都可以正常使用Tomcat,但是当我尝试通过Glassfish运行它时会抛出此错误:

  

发布失败无法为模块部署JsfProject部署错误:   JsfProject:加载应用程序时出现异常:java.lang.Exception:   java.lang.IllegalStateException:ContainerBase.addChild:start:   org.apache.catalina.LifecycleException:   com.sun.faces.config.ConfigurationException:CONFIGURATION FAILED!   未知架构版本:2.1

我正在使用Eclipse Kepler和Glassfish Opensource Edition。

这是我的面孔配置

<?xml version="1.0" encoding="UTF-8"?>

<faces-config
    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-facesconfig_2_1.xsd"
    version="2.1">
    <managed-bean>
        <managed-bean-name>menuBean</managed-bean-name>
        <managed-bean-class>com.project.MenuBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    <navigation-rule>
        <display-name>login.xhtml</display-name>
        <from-view-id>/login.xhtml</from-view-id>
        <navigation-case>
            <from-outcome>login</from-outcome>
            <to-view-id>/welcome.xhtml</to-view-id>
        </navigation-case>
    </navigation-rule>
    <navigation-rule>
        <display-name>welcome.xhtml</display-name>
        <from-view-id>/welcome.xhtml</from-view-id>
        <navigation-case>
            <from-outcome>testPrime</from-outcome>
            <to-view-id>/prime.xhtml</to-view-id>
        </navigation-case>
    </navigation-rule>

</faces-config>

和我的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.project.common</groupId>
  <artifactId>JavaServerFaces</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>JavaServerFaces Maven Webapp</name>
  <url>http://maven.apache.org</url>

  <dependencies>        

    <dependency>
      <groupId>javax.faces</groupId>
      <artifactId>jsf-api</artifactId>
      <version>2.0</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
       <groupId>org.primefaces</groupId>
       <artifactId>primefaces</artifactId>
       <version>3.5</version>
    </dependency>

    <dependency>
        <groupId>org.primefaces.themes</groupId>
        <artifactId>all-themes</artifactId>
        <version>1.0.9</version>
    </dependency>

    <dependency>
        <groupId>org.primefaces.themes</groupId>
        <artifactId>blitzer</artifactId>
        <version>1.0.9</version>
    </dependency>

  </dependencies>

  <repositories>
    <repository>
       <id>java.net.m2</id>
       <name>java.net m2 repo</name>
       <url>http://download.java.net/maven/2</url>
     </repository>
     <repository>
       <id>prime-repo</id>
       <name>PrimeFaces Maven Repository</name>
       <url>http://repository.primefaces.org</url>
       <layout>default</layout>
    </repository>    
  </repositories>

  <build>
    <finalName>JSFLayout</finalName>

    <plugins>
       <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>2.3.1</version>
           <configuration>
               <source>1.6</source>
               <target>1.6</target>
           </configuration>
       </plugin>
    </plugins>
  </build>
</project>

0 个答案:

没有答案