我收到com.ibm.watson.developer_cloud.service.exception.UnauthorizedException: Unauthorized: Access is denied due to invalid credentials错误,而我正在使用正确的凭据。我正在这样做..
进口:
import com.ibm.watson.developer_cloud.visual_recognition.v2_beta.VisualRecognition;
import com.ibm.watson.developer_cloud.visual_recognition.v2_beta.model.VisualClassification;
代码 :
service = new VisualRecognition(VisualRecognition.VERSION_DATE_2015_12_02);
service.setUsernameAndPassword("GXXXXxxxxxxx", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
File image = new File("src/test/resources/visual_recognition/car.png");
VisualClassification result = service.classify(image).execute();
依赖项:
compile 'com.ibm.watson.developer_cloud:java-sdk:3.0.0-RC1'
在 Bluemix 上,Visual Recognition凭证是这样的
{
"credentials": {
"url": "https://gateway.watsonplatform.net/visual-recognition-beta/api",
"password": "GXXXXxxxxxxx",
"username": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
}
请帮我解决问题。提前致谢!