“ JavaServer Faces 2.2需要Dynamic Web Module 2.5或更高版本。”

时间:2019-06-04 19:51:26

标签: amazon-web-services maven web-project aws-toolkit

我正在使用Eclipse for Java EE和AWS Toolkit for Eclipse v2。我使用的是macOS Mojave版本10.14.5。我已经安装了Java 8。

当我第一次创建一个AWS Java Web Project时收到错误消息,提示“无法安装JavaServer Faces 2.2:一个或多个约束未得到满足。”和“ JavaServer Faces 2.2需要Dynamic Web Module 2.5或更高版本。”如该屏幕截图所示:

enter image description here

这是webproject01 / pom.xml:

from urllib.request import Request, urlopen
import json
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import datetime as dt    
from mpl_finance import candlestick_ohlc
import matplotlib.dates as mdates

url = "https://api.binance.com/api/v1/klines?symbol=BTCTUSD&interval=1h"
reponse = urlopen(url)
data = json.load(reponse)
df = pd.DataFrame(data)
df.columns = ['open_time', 'o', 'h', 'l',
              'c', 'v', 'close_time',
              'qav', 'num_trades', 'taker_base_', 'taker_quote_vol',
              'ignore']
df['close_time'] = pd.to_datetime(df['close_time'], unit='ms')
df['close_time'] = df['close_time'].apply(mdates.date2num)
df['o'] = df['o'].astype('float')
df['h'] = df['h'].astype('float')
df['l'] = df['l'].astype('float')
df['c'] = df['c'].astype('float')
df['v'] = df['v'].astype('float')
ax1 = plt.subplot2grid((1,1), (0,0))
ohlc = [df['close_time'], df['o'], df['h'], df['l'], df['c'], df['v']]
candlestick_ohlc(ax1, ohlc)

这是webproject01 / bin / 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.amazonaws.beanstalk</groupId>
  <artifactId>webproject01</artifactId>
  <packaging>war</packaging>
  <version>1.0.0</version>
  <name>archetype-web-app Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>javax</groupId>
      <artifactId>javaee-api</artifactId>
      <version>7.0</version>
    </dependency>

    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-java-sdk-ec2</artifactId>
    </dependency>
    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-java-sdk-s3</artifactId>
    </dependency>
    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-java-sdk-dynamodb</artifactId>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-bom</artifactId>
        <version>1.11.104</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
</project>

这是web.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.amazonaws.beanstalk</groupId>
  <artifactId>webproject01</artifactId>
  <packaging>war</packaging>
  <version>1.0.0</version>
  <name>webproject01 Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>webproject01</finalName>
  </build>
</project>

我想讲到可以直接从Eclipse通过AWS Elastic Beanstalk将AWS Java Web Project部署到AWS的地步。

我已经查看了堆栈上的其他类似帖子溢出,并尝试了它们的解决方案,但是它们都不起作用。他们是较老的职位。

2 个答案:

答案 0 :(得分:2)

也许有人会有用的。

如果您使用的是JBoss工具,则不要为项目设置JSF构面

Properties -> Project Facets -> JavaServer Faces (2.3)

最好使用另一个选项:

Properties -> JBoss Tools Knowledge Base -> JBoss Tools Knowledge Base Support

如果启用此选项,那么XHTML(JSF)页面的Eclipse自动完成(内容辅助)将正常工作。

答案 1 :(得分:1)

您需要升级web.xml才能提供更新的版本:

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">
</web-app>

您当前是在说您的Web应用是Servlet 2.3版的应用。