Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Maven默认arhcetype:jersey qucikstart webapp无法运行webapp-[致命错误]:3:6:_Java_Maven_Pom.xml_Root Element - Fatal编程技术网

Java Maven默认arhcetype:jersey qucikstart webapp无法运行webapp-[致命错误]:3:6:

Java Maven默认arhcetype:jersey qucikstart webapp无法运行webapp-[致命错误]:3:6:,java,maven,pom.xml,root-element,Java,Maven,Pom.xml,Root Element,我已经创建了原型maven项目:jersey quickstart webapp。我已经添加了我以前准备的项目文件,我必须在pom.xml文件中添加以下内容: <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1<

我已经创建了原型maven项目:jersey quickstart webapp。我已经添加了我以前准备的项目文件,我必须在pom.xml文件中添加以下内容:

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
        <type>jar</type>
    </dependency>
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/ParkingSystem"/>
    <Resource name="sql2226123"
       auth="Container" type="javax.sql.DataSource"
       maxActive="20" maxIdle="5" maxWait="10000"
       username="sqldb" password="xyz123"
       driverClassName="com.mysql.jdbc.Driver"
       url="jdbc:mysql://sql2.freemysqlhosting.net:3306/sql2226123"/>
</Context>
现在,完整文件如下所示:

 <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>org.glassfish.jersey.archetypes</groupId>
<artifactId>ParkingSystem</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>ParkingSystem</name>

<build>
    <finalName>ParkingSystem</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <inherited>true</inherited>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.glassfish.jersey</groupId>
            <artifactId>jersey-bom</artifactId>
            <version>${jersey.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
     <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet-core</artifactId>
        <!-- use the following artifactId if you don't need servlet 2.x compatibility -->
        <!-- artifactId>jersey-container-servlet</artifactId -->
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.inject</groupId>
        <artifactId>jersey-hk2</artifactId>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-json-binding</artifactId>
    </dependency>
</dependencies>
<properties>
    <jersey.version>2.27</jersey.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

我知道这个错误意味着有多个根元素。然而,这是来自原型的默认文件,并且作为根元素存在,或者我不明白什么?每个其他元素都在元素内。我所做的唯一更改是在标记的顶部添加了javaxservlet依赖项。我检查了xmlns,没有一个是自动关闭的。我在您的context.xml文件中找到标记:

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
        <type>jar</type>
    </dependency>
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/ParkingSystem"/>
    <Resource name="sql2226123"
       auth="Container" type="javax.sql.DataSource"
       maxActive="20" maxIdle="5" maxWait="10000"
       username="sqldb" password="xyz123"
       driverClassName="com.mysql.jdbc.Driver"
       url="jdbc:mysql://sql2.freemysqlhosting.net:3306/sql2226123"/>
</Context>

请发布错误消息。我已经更新了一个问题,但是,我得到的唯一错误消息是有问题的标题中的一条:我的意思是,听起来元素的格式不正确,或者是紧接着的什么。也许我们在这里看不到。您可以将原始内容发布到类似pastebin的内容中。但我会检查一些格式问题,你是否有一个带有XML语法突出显示的编辑器?在这里,我将它放入pastebin-作为XML:完整的消息将提供有关何时以及哪一步打印出此致命错误的更多信息。谢谢!非常感谢:我现在会记得在这种情况下检查所有其他XML文件!你救了我: