播放执行异常:noclassDeffoundError:javax/ws/rs/core/wendess $状态



好日子。我遇到了下一个问题。在项目中,我们使用的是UI部件的游戏框架模块,并使用逻辑部件的REST服务模块,并带有枚举模型。我遇到了下一个问题。当我使用其他模块的枚举(下面的代码(时:

    import javax.ws.rs.core.Response;
public enum ErrorCodeEnum {
 BAD_DATE_FORMAT("E2021", "Can not parse date", Response.Status.BAD_REQUEST);
    ErrorCodeEnum(String code, String message, Response.Status status) {
        this.code = code;
        this.message = message;
        this.status = status;
    }
...
}

并尝试在控制器中使用它在play UI部件中:

import module.FormParser;
import  module.breadcrumb.Breadcrumb;
import  module.entities.Holiday;
import  module.entities.HolidayApprover;
import  module.entities.Profile;
import  module.entity.AuthenticationObject;
import  module.enums.*;
import  module.exception.WSException;
import  module.security.RoleCheck;
import service.WSWrapper;
import service.WSWrapper.ProfileService;
import com.google.gson.JsonObject;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
import controllers.auth.Authentication;
import controllers.security.SecurityHelper;
import jobs.workorders.startup.FileSystemJob;
import models.PersonToIdNameAdapter;
import models.enums.DashboardView;
import models.form.*;
import models.persistence.Person;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
import org.apache.commons.lang.time.DateUtils;
import org.joda.time.DateTime;
import org.joda.time.Days;
import persistence.PersonRepository;
import play.Logger;
import play.Play;
import play.data.validation.Valid;
import play.data.validation.Validation;
import play.i18n.Messages;
import play.mvc.After;
import play.mvc.Before;
import play.mvc.Http;
import play.mvc.With;
import utils.ProfilesLoader;
import utils.Utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Calendar;
import java.util.regex.Pattern;
@With(Authentication.class)
public class Employees extends Application {
...
@Breadcrumb(level = 3, key = "breadcrumb.holiday.request", parentKey = "breadcrumb.raise.request")
    public static void holidayRequest(@Valid HolidayForm holidayForm, List<String> approvers, String forPerson) {
...
//Here i have a problem with compilation
ErrorCodeEnum err = ErrorCodeEnum.ACC_PERMISSION_DENIED; 
...
}

在Maven外部库中,我已经在依赖项Javax.ws.rs.ap中拥有的模块之一:2.0.1库。我在运行时汇编期间遇到了播放框架:

brouser中的执行异常:

NoClassDefFoundError occured : javax/ws/rs/core/Response$Status
In /app/controllers/Employees.java (around line 449)
ErrorCodeEnum err = ErrorCodeEnum.ACC_PERMISSION_DENIED;

在控制台输出中:

Execution exception (In /app/controllers/Employees.java around line 449)
NoClassDefFoundError occured : javax/ws/rs/core/Response$Status
play.exceptions.JavaExecutionException: javax/ws/rs/core/Response$Status
        at play.mvc.ActionInvoker.invoke(ActionInvoker.java:229)
        at Invocation.HTTP Request(Play!)
Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/core/Response$Status
        at module.enums.ErrorCodeEnum.<init>(ErrorCodeEnum.java:69)
        at module.enums.ErrorCodeEnum.<clinit>(ErrorCodeEnum.java:7)
        at controllers.Employees.holidayRequest(Employees.java:449)
        at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:527)
        at play.mvc.ActionInvoker.invoke(ActionInvoker.java:478)
        at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:454)
        at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:449)
        at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
        ... 1 more
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.Response$Status
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 9 more

来自没有任何汇编问题的相同模块的枚举。我这是与Javax.ws.rs.core.response的冲突。感谢您的建议。

由我自己解决。游戏需要单独添加依赖播放汇编。添加到play依赖项.yml:

- javax.ws.rs -> javax.ws.rs-api 2.0

我认为您需要使用当前依赖项中的不同版本。您还可以尝试这些依赖项,将依赖项添加到pom.xml中并更新项目。

    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20160810</version>
    </dependency>

    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-server -->
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.19.3</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-servlet -->
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-servlet</artifactId>
        <version>1.19.3</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-json -->
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-json</artifactId>
        <version>1.19.3</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-client -->
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-client</artifactId>
        <version>1.19.3</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-core -->
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-core</artifactId>
        <version>1.19.3</version>
    </dependency>

相关内容

  • 没有找到相关文章