JavaServer Faces 2.2需要动态Web模块2.5或更新版本 [英] JavaServer Faces 2.2 requires Dynamic Web Module 2.5 or newer

查看:149
本文介绍了JavaServer Faces 2.2需要动态Web模块2.5或更新版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试过几件事情,但仍然存在这个问题。我正在使用Eclipse Kepler。我导入maven项目时遇到以下错误


无法安装JavaServer Faces 2.2:一个或多个约束尚未满足



JavaServer Faces 2.2需要动态Web模块2.5或更高版本


1)我尝试了几件事如 Maven Java EE配置标记与Java中所述服务器面孔1.2 ,但没有运气。
2)另外我进入了.settings并修改了org.eclipse.wst.common.project.facet.core.xml,并将jst.web修改为2.5或3.0版本;但是我收到一些其他错误。



我试图使Sencha GXT示例在基于 http://neiliscoding.blogspot.ie/2012/05/how- to-setup-examples-for-use-in-gxt-3.html ,并在eclipse中使这个javaserver面临问题。
这是我的pom.xml

 <?xml version =1.0encoding =UTF-8 ?> 
< project xmlns =http://maven.apache.org/POM/4.0.0xmlns: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\">

<! - 使用GWT生成的POM文件webAppCreator - >
< modelVersion> 4.0.0< / modelVersion>
< parent>
< artifactId> xx< / artifactId>
< groupId> ss< / groupId>
< version> 0.0.1-SNAPSHOT< / version>
< / parent>

< artifactId> guis< / artifactId>
< packaging> war< / packaging>

< name> GWT Maven Archetype< / name>

< properties>
<! - 设置GWT版本的便利属性 - >
< gwtVersion> 2.5.1< / gwtVersion>
<! - GWT至少需要Java 1.5 - >
< webappDirectory> $ {project.build.directory} / $ {project.build.finalName}< / webappDirectory>
< project.build.sourceEncoding> UTF-8< /project.build.sourceEncoding>
< / properties>

<依赖关系>
<依赖关系>
< groupId> com.google.gwt.inject< / groupId>
< artifactId> gin< / artifactId>
< version> 2.1.2< / version>
< / dependency>
<依赖关系>
< groupId> javax< / groupId>
< artifactId> javaee-api< / artifactId>
< version> 7.0< / version>
< / dependency>

<依赖关系>
< groupId> com.google.gwt< / groupId>
< artifactId> gwt-servlet< / artifactId>
< version> $ {gwtVersion}< / version>
< scope>运行时< / scope>
< / dependency>
<依赖关系>
< groupId> com.google.gwt< / groupId>
< artifactId> gwt-user< / artifactId>
< version> $ {gwtVersion}< / version>
< scope>已提供< / scope>
< / dependency>

<依赖关系>
< groupId> com.google.gwt< / groupId>
< artifactId> gwt-dev< / artifactId>
< version> $ {gwtVersion}< / version>
< scope>已提供< / scope>
< / dependency>


<依赖关系>
< groupId> junit< / groupId>
< artifactId> junit< / artifactId>
< version> 4.7< / version>
< scope> test< / scope>
< / dependency>
<依赖关系>
< groupId> javax.validation< / groupId>
< artifactId> validation-api< / artifactId>
< version> 1.0.0.GA< / version>
< scope> test< / scope>
< / dependency>
<依赖关系>
< groupId> javax.validation< / groupId>
< artifactId> validation-api< / artifactId>
< version> 1.0.0.GA< / version>
< classifier> sources< / classifier>
< scope> test< / scope>
< / dependency>
<依赖关系>
< groupId> com.sencha.gxt< / groupId>
< artifactId> gxt-chart< / artifactId>
< version> 3.0.1< / version>
< / dependency>

<依赖关系>
< groupId> com.sencha.gxt< / groupId>
< artifactId> gxt< / artifactId>
< version> 3.0.1< / version>
< / dependency>

<依赖关系>
< groupId> com.sencha.gxt< / groupId>
< artifactId> uibinder-bridge< / artifactId>
< version> 2.4.0< / version>
< / dependency>



< / dependencies>

< build>
<! - 在用于开发模式的文件夹中生成编译的东西 - >
< outputDirectory> $ {webappDirectory} / WEB-INF / classes< / outputDirectory>

< plugins>

<! - GWT Maven插件 - >
< plugin>
< groupId> org.codehaus.mojo< / groupId>
< artifactId> gwt-maven-plugin< / artifactId>
< version> 2.5.1< / version>
<执行>
< execution>
< goals>
< goal> compile< / goal>
< goal> test< / goal>
<! - < goal> i18n< / goal> - >
< goal> generateAsync< / goal>
< / goals>
< / execution>
< / executions>
<! - 插件配置。有很多可用选项,请参阅codehaus.org上的gwt-maven-plugin
文档 - >
< configuration>
< runTarget> guis.html< / runTarget>
< hostedWebapp> $ {webappDirectory}< / hostedWebapp>
< i18nMessagesBundle> com.harmonia.client.Messages< / i18nMessagesBundle>
< / configuration>
< / plugin>

<! - 在执行gwt之前复制静态Web文件:run - >
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-war-plugin< / artifactId>
< version> 2.1.1< / version>
<执行>
< execution>
< phase> compile< / phase>
<! - < goals> <目标>分解< /目标> < /目标> - >
< / execution>
< / executions>
< configuration>
< webappDirectory> $ {webappDirectory}< / webappDirectory>
< / configuration>
< / plugin>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-compiler-plugin< / artifactId>
< version> 2.3.2< / version>
< configuration>
< source> 1.7< / source>
< target> 1.7< / target>
< / configuration>
< / plugin>
< / plugins>
< / build>



这是我的web.xml文件

 <?xml version =1.0encoding =UTF-8?> 
<! -  !DOCTYPE web-app
PUBLIC - // Sun Microsystems,Inc.//DTD Web应用程序2.3 // EN
http:// java .sun.com / DTD /网络app_2_3.dtd>

< web-app> - >

< 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>
< display-name> GXT创建的Web应用< / display-name>



<! - 要提供的默认页面 - >
< welcome-file-list>
< welcome-file> guis.html< / welcome-file>
< / welcome-file-list>



如你所见,我在web.xml中尝试了不同的dtds,但是我仍然有问题。感谢任何提示

解决方案

您的问题是您将web.xml标记为符合servlet 2.3(或者甚至不符合那个 - 我不知道你的评论中的doctype是如何解释的)

 <?xml version =1.0encoding = UTF-8 >?; 
<! -  !DOCTYPE web-app
PUBLIC - // Sun Microsystems,Inc.//DTD Web应用程序2.3 // EN
http:// java .sun.com / DTD /网络app_2_3.dtd>

,您需要至少符合Eclipse工具的servlet 2.5兼容性。 >

 <?xml version =1.0encoding =UTF-8?> 
< web-app version =2.5xmlns =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_2_5.xsd>

(未经测试 - 从 http://javahowto.blogspot.dk/2009/10/sample-webxml-servlet-25.html



您可能需要重新创建Eclipse项目才能更改。


I tried few things, but still this problem persists. I am using Eclipse Kepler. I get following error on importing maven project

JavaServer Faces 2.2 can not be installed : One or more constraints have not been satisfied

JavaServer Faces 2.2 requires Dynamic Web Module 2.5 or newer

1) I tried few things as mentioned in Maven Java EE Configuration Marker with Java Server Faces 1.2, but no luck. 2)Also I went into .settings and modified org.eclipse.wst.common.project.facet.core.xml and modified jst.web to point to 2.5 or 3.0 version; but I get some other errors.

I am trying to make Sencha GXT examples work in maven/eclipse build based on http://neiliscoding.blogspot.ie/2012/05/how-to-setup-examples-for-use-in-gxt-3.html and having this javaserver faces problem in eclipse. Here is my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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">

<!-- POM file generated with GWT webAppCreator -->
<modelVersion>4.0.0</modelVersion>
<parent>
    <artifactId>xx</artifactId>
    <groupId>ss</groupId>
    <version>0.0.1-SNAPSHOT</version>
</parent>

<artifactId>guis</artifactId>
<packaging>war</packaging>

<name>GWT Maven Archetype</name>

<properties>
    <!-- Convenience property to set the GWT version -->
    <gwtVersion>2.5.1</gwtVersion>
    <!-- GWT needs at least java 1.5 -->
    <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>com.google.gwt.inject</groupId>
        <artifactId>gin</artifactId>
        <version>2.1.2</version>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
    </dependency>

    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-servlet</artifactId>
        <version>${gwtVersion}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-user</artifactId>
        <version>${gwtVersion}</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-dev</artifactId>
        <version>${gwtVersion}</version>
        <scope>provided</scope>
    </dependency>


    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.7</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
        <classifier>sources</classifier>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.sencha.gxt</groupId>
        <artifactId>gxt-chart</artifactId>
        <version>3.0.1</version>
    </dependency>

    <dependency>
        <groupId>com.sencha.gxt</groupId>
        <artifactId>gxt</artifactId>
        <version>3.0.1</version>
    </dependency>

    <dependency>
        <groupId>com.sencha.gxt</groupId>
        <artifactId>uibinder-bridge</artifactId>
        <version>2.4.0</version>
    </dependency>



</dependencies>

<build>
    <!-- Generate compiled stuff in the folder used for developing mode -->
    <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>

    <plugins>

        <!-- GWT Maven Plugin -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>2.5.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>test</goal>
                        <!-- <goal>i18n</goal> -->
                        <goal>generateAsync</goal>
                    </goals>
                </execution>
            </executions>
            <!-- Plugin configuration. There are many available options, see gwt-maven-plugin 
                documentation at codehaus.org -->
            <configuration>
                <runTarget>guis.html</runTarget>
                <hostedWebapp>${webappDirectory}</hostedWebapp>
                <i18nMessagesBundle>com.harmonia.client.Messages</i18nMessagesBundle>
            </configuration>
        </plugin>

        <!-- Copy static web files before executing gwt:run -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <!-- <goals> <goal>exploded</goal> </goals> -->
                </execution>
            </executions>
            <configuration>
                <webappDirectory>${webappDirectory}</webappDirectory>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

Here is my web.xml file

 <?xml version="1.0" encoding="UTF-8"?>
  <!-- <!DOCTYPE web-app
 PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app> -->

<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">
<display-name>GXT Created Web Application</display-name>



<!-- Default page to serve -->
<welcome-file-list>
    <welcome-file>guis.html</welcome-file>
</welcome-file-list>

As you can see, I tried different dtds in above web.xml, but I still have the problem. Would appreciate any hints

解决方案

Your problem is that you have marked your web.xml as being servlet 2.3 compliant (or perhaps not even that - I am not sure how your doctype in a comment is interpreted)

 <?xml version="1.0" encoding="UTF-8"?>
  <!-- <!DOCTYPE web-app
 PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd">

and you need it to be at least servlet 2.5 compliant for the Eclipse tooling to work.

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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_2_5.xsd">

(untested - copied from http://javahowto.blogspot.dk/2009/10/sample-webxml-servlet-25.html)

You may need to recreate the Eclipse project to have the changes picked up.

这篇关于JavaServer Faces 2.2需要动态Web模块2.5或更新版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆