java.lang.IllegalAccessError: class com.google.iam.v1.TestIamPermissionsRequest tried to access method #8970
Labels
priority: p3
Desirable enhancement or fix. May not be included in next release.
samples
Issues that are directly related to samples.
type: question
Request for information or clarification. Not an issue.
Jar files as following:
com.google.cloud
google-cloud-vertexai
0.1.0
Check the dependency:
com.google.cloud:google-cloud-vertexai:0.1.0:
com.google.api.grpc:proto-google-iam-v1:1.24.0
Code segment:
@RestController
@RequestMapping("/api/gemini")
@slf4j
public class GeminiChatController {
@value("${google.credentials}")
private Resource gcpKeyFile;
@GetMapping("/chat")
public void test() {
String projectId = "gptdemo-408313";
String location = "us-west2";
String modelName = "gemini-pro-vision";
try {
String output = this.simpleQuestion(projectId, location, modelName);
log.info("output: {}", output);
System.out.println(output);
}catch (Exception e) {
System.out.println(e);}
}
public String simpleQuestion(String projectId, String location, String modelName)
throws Exception {
// Initialize client that will be used to send requests.
// This client only needs to be created once, and can be reused for multiple requests.
GoogleCredentials credentials = GoogleCredentials.fromStream(gcpKeyFile.getInputStream());
}
}
It failed with the error:
java.lang.IllegalAccessError: class com.google.iam.v1.TestIamPermissionsRequest tried to access method 'com.google.protobuf.LazyStringArrayList com.google.protobuf.LazyStringArrayList.emptyList()' (com.google.iam.v1.TestIamPermissionsRequest and com.google.protobuf.LazyStringArrayList are in unnamed module of loader 'app')
at com.google.iam.v1.TestIamPermissionsRequest.(TestIamPermissionsRequest.java:127) ~[proto-google-iam-v1-1.24.0.jar:1.24.0]
at com.google.iam.v1.TestIamPermissionsRequest.(TestIamPermissionsRequest.java:918) ~[proto-google-iam-v1-1.24.0.jar:1.24.0]
at com.google.cloud.vertexai.api.stub.GrpcPredictionServiceStub.(GrpcPredictionServiceStub.java:218) ~[google-cloud-vertexai-0.1.0.jar:0.1.0]
at com.google.cloud.vertexai.api.stub.PredictionServiceStubSettings.createStub(PredictionServiceStubSettings.java:292) ~[google-cloud-vertexai-0.1.0.jar:0.1.0]
at com.google.cloud.vertexai.api.PredictionServiceClient.(PredictionServiceClient.java:178) ~[google-cloud-vertexai-0.1.0.jar:0.1.0]
at com.google.cloud.vertexai.api.PredictionServiceClient.create(PredictionServiceClient.java:160) ~[google-cloud-vertexai-0.1.0.jar:0.1.0]
at com.google.cloud.vertexai.VertexAI.getPredictionServiceClient(VertexAI.java:151) ~[google-cloud-vertexai-0.1.0.jar:0.1.0]
at com.google.cloud.vertexai.generativeai.preview.GenerativeModel.generateContentStream(GenerativeModel.java:698) ~[google-cloud-vertexai-0.1.0.jar:0.1.0]
at com.google.cloud.vertexai.generativeai.preview.GenerativeModel.generateContent(GenerativeModel.java:396) ~[google-cloud-vertexai-0.1.0.jar:0.1.0]
at com.google.cloud.vertexai.generativeai.preview.GenerativeModel.generateContent(GenerativeModel.java:320) ~[google-cloud-vertexai-0.1.0.jar:0.1.0]
at com.google.cloud.vertexai.generativeai.preview.GenerativeModel.generateContent(GenerativeModel.java:269) ~[google-cloud-vertexai-0.1.0.jar:0.1.0]
at com.md.gpt.controller.GeminiChatController.simpleQuestion(GeminiChatController.java:46) ~[classes/:na]
at com.md.gpt.controller.GeminiChatController.test(GeminiChatController.java:29) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.31.jar:5.3.31]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.31.jar:5.3.31]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.31.jar:5.3.31]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.31.jar:5.3.31]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.31.jar:5.3.31]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.31.jar:5.3.31]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1072) ~[spring-webmvc-5.3.31.jar:5.3.31]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:965) ~[spring-webmvc-5.3.31.jar:5.3.31]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.31.jar:5.3.31]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.31.jar:5.3.31]
Could you please have a look, thanks?
The text was updated successfully, but these errors were encountered: