Maven tomEE NoClassDefFoundError:javax / ws / rs / core / Link

时间:2019-06-15 07:21:38

标签: java rest maven tomee

我有一个Maven项目,并且开发了RESTful服务,并且使用服务器TomEE。我想使用javax.ws.rs.core,因为我使用了Link类。我认为此类在javax.ws.rs.core中。

我了解到我可以配置 openejb.api.javax.ws.rs.Path.validation = false

但是我不知道[TomEE] \ conf \ system.properties在哪里

启动服务器时出现错误

Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/core/Link

我的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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.readlearncode</groupId>
        <artifactId>dukesbookshop</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <artifactId>rest-server</artifactId>
    <packaging>war</packaging>

    <name>rest-server</name>
    <url>http://localhost:8080</url>

    <properties>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <java.version>1.8</java.version>
        <javaee-api.version>7.0</javaee-api.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>${javaee-api.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>
        <!-- For Jersey 1.x -->
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-server</artifactId>
            <version>1.19</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-servlet</artifactId>
            <version>1.19</version>
        </dependency> 
        <!-- <dependency>
             <groupId>org.apache.openejb</groupId>
            <artifactId>javaee-api</artifactId>
             <version>6.0-6</version>
             <scope>provided</scope>
        </dependency> -->
        <!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api -->
        <!-- <dependency>
              <groupId>javax.ws.rs</groupId>
              <artifactId>javax.ws.rs-api</artifactId>
            <version>2.0</version>
        </dependency> -->
    </dependencies>

    <build>
        <finalName>rest-server</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                 <configuration>
                    <url>http://localhost:8080/manager/text</url>
                    <path>/rest-server</path>
                    <!-- Set update to true to avoid exist war package can not be override error -->
                    <update>true</update>
                    <!-- Because deploy this maven project using plugin in pom so use the manager-script role user. -->
                    <username>tomcat</username>
                    <password>tomcat</password>
                </configuration>
            </plugin>
            <plugin>
                  <groupId>org.apache.openejb.maven</groupId>
                 <artifactId>tomee-maven-plugin</artifactId>
                 <version>1.7.1</version>
                <configuration>
                     <tomeeVersion>1.7.1</tomeeVersion>
                     <tomeeClassifier>plus</tomeeClassifier>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.0</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <skipTests>true</skipTests>
                    <systemPropertyVariables>
                        <!-- This is needed to tell the unit tests which profile we are running. -->
                    </systemPropertyVariables>
                </configuration>
            </plugin>
        </plugins>
    </build>

我如何配置TomEE以使用javax.ws.rs.core?

0 个答案:

没有答案