【问题标题】:Deployment of basic Java web application to AWS : javax/xml/bind/JAXBException将基本 Java Web 应用程序部署到 AWS:javax/xml/bind/JAXBException
【发布时间】:2020-01-09 14:39:45
【问题描述】:

我在尝试将应用程序部署到 AWS 时不断收到此错误:

An internal error occurred during: "Updating AWS Elastic Beanstalk environment:
SampleWebApplication".
javax/xml/bind/JAXBException

这是我的工作:

  1. 我基于 maven-archetype-webapp 1.0 创建新的 Maven 项目
  2. 我为 pom.xml 文件配置了依赖项(完整文件如下)
  3. 我在 index.jsp 中输入任何内容(它应该是超级简单的应用程序)
  4. 我在 tomcat7:run 上运行它,它在 http://localhost:8080/ 上运行起来就像一个魅力

  5. 我创建 AWS 服务器

  6. 我选择项目,我选择 Amazon Web Services Tool --> 部署到 AWS Elastik Beanstalk,选择添加的服务器,我不断收到此消息:

我无法在互联网上找到有关此错误的任何信息。我发现的唯一一件事是它连接到 Java 版本,但我运行的是 Java 1.8(正如我发现的一篇文章中所建议的那样)。

谁能帮帮我?我正在按照this 说明部署应用程序。 我是 AWS 的超级新手,所以我什至不知道从哪里开始!

index.jsp

<html>
    <body>
        <h2>Hello There!</h2>
    </body>
</html>

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.dominikazb</groupId>
<artifactId>SampleWebApplication</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>SampleWebApplication Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
    <tomcat.version>7.0.50</tomcat.version>
</properties>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-core</artifactId>
        <version>2.3.0.1</version>
    </dependency>
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.3.1</version>
    </dependency>


</dependencies>
<build>
    <finalName>SampleWebApplication</finalName>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.9</version>
            <configuration>
                <wtpversion>2.0</wtpversion>
                <wtpContextName>todo</wtpContextName>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
                <verbose>true</verbose>
                <source>1.8</source>
                <target>1.8</target>
                <showWarnings>true</showWarnings>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <path>/</path>
                <contextReloadable>true</contextReloadable>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
                <webappDirectory>${project.build.directory}/${project.artifactId}
                </webappDirectory>
                <warName>${project.artifactId}</warName>
            </configuration>
        </plugin>
    </plugins>
</build>
</project>

项目结构

请,请,请帮忙!

【问题讨论】:

标签: java amazon-web-services deployment web-applications


【解决方案1】:

最后,我在网站上找到了这个问题的答案: https://github.com/aws/aws-toolkit-eclipse/issues/123 那里的例子是在 Unix 中。我的在 Window 7 中。我根据网站建议所做的是:

查找文件 jaxb-api-2.2.5.jar 的位置。我不确定是否必须使用 2.2.5 版。建议尝试任何你有的。 我的位于 C:\Users\myUserName\.m2\repository\javax\xml\bind\jaxb-api\2.2.5.

退出 Eclipse IDE。

在管理员模式下打开 PowerShell。 cd 到您的用户目录(我的情况是 C:\Users\myUserName)并执行以下命令以使用指向 jaxb-api-2.2.5.jar 的 -dev 选项打开 Eclipse IDE。 C:\Users\myUserName\eclipse\jee-2020-09\eclipse\eclipse -dev $(ls ~/.m2/repository/javax/xml/bind/jaxb-api/*/*[0-9].jar | Select-Object -Last 1)

当然,你的 eclipse.exe 的位置可以不同。

编码愉快!

【讨论】:

  • 有一个错字。 C:\Users\myUserName.m2\repository 应该是 C:\Users\myUserName\.m2\repository
  • 还有一个粘贴错误:~/.m2/repository/javax/xml/bind/jaxb-api//[0-9].jar应该是~/.m2/repository/javax /xml/bind/jaxb-api/*/*[0-9].jar
猜你喜欢
  • 2015-08-09
  • 2016-02-16
  • 1970-01-01
  • 2012-07-04
  • 2019-07-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多