GCP Vertex AI Feature Store Java客户端调用ReadFeatureValues报404错误求助
问题描述
按照Google Cloud Java官方文档使用FeaturestoreOnlineServingServiceClient服务访问特征,代码片段如下:
try (FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = FeaturestoreOnlineServingServiceClient.create()) { String gcpProject = this.featureStoreConfig.getProject(); String featureStoreName = this.featureStoreConfig.getFeatureStoreName(); String featureStoreLocation = this.featureStoreConfig.getLocation(); EntityTypeName entityTypeName = EntityTypeName.of(gcpProject, featureStoreLocation, featureStoreName, entityType); System.out.println(entityTypeName); ReadFeatureValuesResponse response = featurestoreOnlineServingServiceClient.readFeatureValues(entityTypeName);
执行readFeatureValues方法时崩溃,错误信息如下:
Failed to complete request: com.google.api.gax.rpc.UnimplementedException: io.grpc.StatusRuntimeException: UNIMPLEMENTED: HTTP status code 404 invalid content-type: text/html; charset=UTF-8 <html> ... <title>Error 404 (Not Found)!!1</title> ... <p>The requested URL <code>/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/ReadFeatureValues</code> was not found on this server. <ins>That’s all we know.</ins>
可能的原因
- 服务端点配置错误:默认创建的客户端可能未指定正确的区域端点。如果Feature Store部署在非默认区域,需要显式配置对应区域的服务端点,否则请求会被发送到错误的服务器,导致404。
- 资源名称错误或资源不存在:检查
EntityTypeName生成时使用的项目ID、区域、Feature Store名称、实体类型名称是否完全正确,包括拼写、大小写、特殊字符。若目标资源不存在或名称有误,服务端会返回404。 - Vertex AI API未启用:确认你的GCP项目中已经启用了Vertex AI API(原AI Platform API)。未启用API会导致请求被路由到无法处理该接口的服务器,返回404错误。
- 客户端库版本不兼容:使用的
google-cloud-aiplatform客户端库版本与服务端API版本不匹配,导致请求的方法路径不被服务端识别,触发UNIMPLEMENTED错误。 - 网络代理配置问题:如果环境中有代理,可能导致请求被转发到错误的服务器,返回HTML格式的404响应(正常gRPC请求应返回二进制或JSON格式响应)。检查代理是否正确放行GCP服务的端点请求。
内容的提问来源于stack exchange,提问作者r-sniper
相关产品推荐
相关产品推荐

