Azure 自定义视觉参数 this.client.endpoint() 是必需的,不能为空

Azure Custom Vision Parameter this.client.endpoint() is required and cannot be null

我正在尝试按照此处找到的 Azure 文档中的教程来使用基本的自定义视觉图像分类器:https://docs.microsoft.com/en-us/azure/cognitive-services/custom-vision-service/quickstarts/image-classification?pivots=programming-language-java

我逐字逐句地学习了本教程,并花了几天时间尝试解决这个问题。我遇到的问题是 运行 我得到以下堆栈跟踪的代码:

Parameter this.client.endpoint() is required and cannot be null.
java.lang.IllegalArgumentException: Parameter this.client.endpoint() is required and cannot be null.
    at com.microsoft.azure.cognitiveservices.vision.customvision.training.implementation.TrainingsImpl.createProjectWithServiceResponseAsync(TrainingsImpl.java:2313)
    at com.microsoft.azure.cognitiveservices.vision.customvision.training.implementation.TrainingsImpl$TrainingsCreateProjectParameters.execute(TrainingsImpl.java:2401)
    at com.microsoft.azure.cognitiveservices.vision.customvision.samples.CustomVisionSamples.ImageClassification_Sample(CustomVisionSamples.java:67)
    at com.microsoft.azure.cognitiveservices.vision.customvision.samples.CustomVisionSamples.runSample(CustomVisionSamples.java:46)
    at com.microsoft.azure.cognitiveservices.vision.customvision.samples.CustomVisionSamples.main(CustomVisionSamples.java:374)

端点在此处定义并作为参数传递

final String Endpoint = System.getenv("AZURE_CUSTOMVISION_ENDPOINT");

            CustomVisionTrainingClient trainClient = CustomVisionTrainingManager.authenticate("https://{Endpoint}/customvision/v3.0/training/", CustomVisionTrainingClientKey).withEndpoint(Endpoint);
            CustomVisionPredictionClient predictClient = CustomVisionPredictionManager.authenticate("https://{Endpoint}/customvision/v3.0/prediction/", predictionApiKey).withEndpoint(Endpoint);

虽然本教程没有明确说明要这样做,但我已尝试使用 PowerShell 手动设置系统环境变量 AZURE_CUSTOMVISION_ENDPOINT,无论是否设置此设置都无法正常工作。

我错过了什么吗?任何帮助将不胜感激!

解决了我自己的问题。环境变量没有正确设置并且是空指针。我用纯文本替换了对字符串的 System.getenv 调用,它工作正常。