I'm getting gitlab private token in request param. How to validate this token valid or not.
I have used gitlab4j-api maven dependency but getting error:
java.lang.ClassNotFoundException: javax.ws.rs.core.StreamingOutput
tried below code:
@PostMapping("/validate-token")
public void validateToken(@RequestParam String token, @RequestBody Object json) {
System.out.printf("json " + json);
System.out.println("Token " + token);
//TODO need to fix error on below line.
GitLabApi gitLabApi = new GitLabApi("https://gitlab.com", token);
System.out.println("gitLabApi " + gitLabApi.toString());
UserApi userApi = gitLabApi.getUserApi();
System.out.println("UserApi " + userApi);
if (userApi != null) {
System.out.println("token is valid");
} else {
System.out.println("token is not valid");
}
}
Error -> Stack Trace
Exception Details:
Location:
org/gitlab4j/api/GitLabApiClient.createApiClient()Ljavax/ws/rs/client/Client; @18: invokevirtual
Reason:
Type 'org/glassfish/jersey/client/JerseyClientBuilder' (current frame, stack[0]) is not assignable to 'javax/ws/rs/client/ClientBuilder'
Current Frame:
bci: @18
flags: { }
locals: { 'org/gitlab4j/api/GitLabApiClient', 'org/glassfish/jersey/client/JerseyClientBuilder' }
stack: { 'org/glassfish/jersey/client/JerseyClientBuilder', 'java/lang/Class' }
Bytecode:
0000000: bb00 7d59 b700 7e2a b400 1ab6 007f 4c2b
0000010: 122d b600 8057 2b12 2fb6 0080 572a b400
0000020: 8199 0013 2b2a b400 82b6 0083 2ab4 0084
0000030: b600 8557 2a2b b600 86b5 0031 2ab4 0031
0000040: b0
Stackmap Table:
append_frame(@52,Object[#374])
] with root cause
java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
org/gitlab4j/api/GitLabApiClient.createApiClient()Ljavax/ws/rs/client/Client; @18: invokevirtual
Reason:
Type 'org/glassfish/jersey/client/JerseyClientBuilder' (current frame, stack[0]) is not assignable to 'javax/ws/rs/client/ClientBuilder'
Current Frame:
bci: @18
flags: { }
locals: { 'org/gitlab4j/api/GitLabApiClient', 'org/glassfish/jersey/client/JerseyClientBuilder' }
stack: { 'org/glassfish/jersey/client/JerseyClientBuilder', 'java/lang/Class' }
Bytecode: