gpt4 book ai didi

java - 无法创建缓存目录 :Vert. x:Jenkins 构建

转载 作者:行者123 更新时间:2023-12-01 20:08:25 25 4
gpt4 key购买 nike

我的单元测试项目在使用 Jenkins 配置时遇到错误。当我从命令提示符本地运行 Maven 测试时,测试运行良好。

我得到的错误:

feature ("Verify GET User Details API")
cucumber.runtime.CucumberException: java.lang.IllegalStateException: Failed to create cache dir
at cucumber.api.testng.TestNGCucumberRunner.runCucumber(TestNGCucumberRunner.java:78)
at com.ibm.wce.scbn.cc.runner.BaseRunner.feature(BaseRunner.java:32)
Caused by: java.lang.IllegalStateException: Failed to create cache dir
at io.vertx.core.file.impl.FileResolver.setupCacheDir(FileResolver.java:332)
at io.vertx.core.file.impl.FileResolver.<init>(FileResolver.java:87)
at io.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:165)
at io.vertx.core.impl.VertxImpl.vertx(VertxImpl.java:92)
at io.vertx.core.impl.VertxFactoryImpl.vertx(VertxFactoryImpl.java:40)
at io.vertx.core.impl.VertxFactoryImpl.vertx(VertxFactoryImpl.java:32)
at io.vertx.core.impl.VertxFactoryImpl.vertx(VertxFactoryImpl.java:27)
at io.vertx.core.Vertx.vertx(Vertx.java:75)
at com.ibm.wce.scbn.cc.util.TokenUtil.<init>(TokenUtil.java:32)
at com.ibm.wce.scbn.cc.util.TokenUtil.getInstance(TokenUtil.java:46)
at com.ibm.wce.scbn.cc.stepdefinitions.AccountsByID.we_send_Get_request_to_service_for_Account_with_source_and_iui(AccountsByID.java:369)
at ✽.We send Get request to service for Account "1" with source "1" and iui "1"(./features/AccountsByID/AccountsByID.feature:7)

TokenUtil.java

public class TokenUtil {

private static final Logger LOGGER = Logger.getLogger(TokenUtil.class.getName());
private static TokenUtil TOKEN_INSTANCE = null;
private static Vertx VERTX = null;
private static JWTAuthOptions JWTAUTHOPS = new JWTAuthOptions();

private TokenUtil() throws Exception {

try {
VERTX = Vertx.vertx();
JsonObject objJason = new JsonObject(VERTX.fileSystem().readFileBlocking(System.getProperty("privatejwtpath")));
JWTAUTHOPS.addJwk(objJason);
} catch (Exception e) {
LOGGER.error("Unable to load private JWK json file", e);
throw e;
}

}

public static TokenUtil getInstance() throws Exception {

if (TOKEN_INSTANCE == null) {
synchronized (TokenUtil.class) {
TOKEN_INSTANCE = new TokenUtil();
}
}
return TOKEN_INSTANCE;
}

public String getJWT(String iui) {

JWTOptions jwtOptions = new JWTOptions();
JsonObject payLoad = new JsonObject();
jwtOptions.setAlgorithm("RS256");
jwtOptions.setExpiresInSeconds(300);
JWTAuth jwt = JWTAuth.create(VERTX, JWTAUTHOPS);
payLoad.put("ibm", new JsonObject().put("iui", iui));
return jwt.generateToken(payLoad, jwtOptions);
}
}

非常感谢任何有关如何解决此问题的建议。谢谢

最佳答案

通过禁用缓存修复问题

关于java - 无法创建缓存目录 :Vert. x:Jenkins 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58973676/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com