java - Azure Functions, "System.Private.CoreLib: Value cannot be null. (Parameter ' 路径 1'). Value cannot be null. (Parameter ' 提供商')"

标签 java http gradle azure-functions endpoint

我正在我的 Gradle(版本 4.6)Java (JDK 1.8) 项目中运行 Azure 函数/核心工具 3.x 和 azure 函数应用程序。我在 localhost:7071 处有一个 GET 端点,我尝试访问 api/devices,但运行 azureFunctionsRun 时不断出现错误。

当我运行 azureFunctionsPackage 时,它​​似乎工作正常。当我运行 azureFunctionsRun 时,出现下面的错误。当我使用azure core tools 2.x时,我使用命令“func start”,一切都完美运行。我有包含样板版本和 ExtensionBundles 脚本的 host.json 文件,以及带有用于我的 Azure Web 作业存储的连接字符串的 local.settings.json:

Azure Functions Core Tools found.
Starting running Azure Functions...
Executing command: cmd.exe /c cd /D C:\git\edge_bootstrap_ms\build\azurefunctions\edge-bootstrap-ms && func host start

              %%%%%%
             %%%%%%
        @   %%%%%%    @
      @@   %%%%%%      @@
   @@@    %%%%%%%%%%%    @@@
 @@      %%%%%%%%%%        @@
   @@         %%%%       @@
     @@      %%%       @@
       @@    %%      @@
            %%
            %

Azure Functions Core Tools (3.0.2106 Commit hash: 5431fca4f603bf9446d7dd2d5f96a43b5f69b5cb)
Function Runtime Version: 3.0.13107
[3/18/2020 8:56:57 PM] FUNCTIONS_WORKER_RUNTIME set to java. Skipping WorkerConfig for language:node
[3/18/2020 8:56:57 PM] FUNCTIONS_WORKER_RUNTIME set to java. Skipping WorkerConfig for language:powershell
[3/18/2020 8:56:57 PM] FUNCTIONS_WORKER_RUNTIME set to java. Skipping WorkerConfig for language:python
[3/18/2020 8:56:57 PM] Starting worker process:C:\Program Files\Java\jdk1.8.0_241\bin\java  -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -noverify -Djava.net.preferIPv4Stack=true -jar "C:\Users\KBRV37\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\java\azure-functions-java-worker.jar" --host 127.0.0.1 --port 61509 --workerId 9ff09cf4-42d8-4e1a-b66e-8058754fe61a --requestId 123c617a-61e1-4b3a-98d8-13b6a5eff6c1 --grpcMaxMessageLength 134217728
[3/18/2020 8:56:57 PM] C:\Program Files\Java\jdk1.8.0_241\bin\java process with Id=10984 started
[3/18/2020 8:56:57 PM] [INFO] {Application.main}: Azure Functions Java Worker  version [ 1.5.2-SNAPSHOT]
[3/18/2020 8:56:58 PM] [INFO] {MessageHandler.handle}: Message generated by "StartStream.Builder"
[3/18/2020 8:56:59 PM] Building host: startup suppressed: 'False', configuration suppressed: 'False', startup operation id: '078289ce-7cd5-4f2f-924b-40696702867a'
[3/18/2020 8:56:59 PM] Reading host configuration file 'C:\git\edge_bootstrap_ms\build\azurefunctions\edge-bootstrap-ms\host.json'
[3/18/2020 8:56:59 PM] Host configuration file read:
[3/18/2020 8:56:59 PM] {
[3/18/2020 8:56:59 PM]   "version": "2.0",
[3/18/2020 8:56:59 PM]   "extensionBundle": {
[3/18/2020 8:56:59 PM]     "id": "Microsoft.Azure.Functions.ExtensionBundle",
[3/18/2020 8:56:59 PM]     "version": "[1.*, 2.0.0)"
[3/18/2020 8:56:59 PM]   }
[3/18/2020 8:56:59 PM] }
[3/18/2020 8:56:59 PM] Reading functions metadata
[3/18/2020 8:56:59 PM] 3 functions found
[3/18/2020 8:56:59 PM] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at (null)
[3/18/2020 8:56:59 PM] Fetching information on versions of extension bundle Microsoft.Azure.Functions.ExtensionBundle available on https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/index.json
[3/18/2020 8:56:59 PM] A host error has occurred during startup operation '078289ce-7cd5-4f2f-924b-40696702867a'.
[3/18/2020 8:56:59 PM] System.Private.CoreLib: Value cannot be null. (Parameter 'path1').
Value cannot be null. (Parameter 'provider')
Application is shutting down...
[3/18/2020 8:56:59 PM] Initialization cancellation requested by runtime.
[3/18/2020 8:56:59 PM] Shutting down language worker channels for runtime:java
[3/18/2020 8:56:59 PM] Stopping host...
[3/18/2020 8:56:59 PM] Host shutdown completed.
:azureFunctionsRun FAILED
1 actionable task: 1 executed

FAILURE: Build failed with an exception.

主机.json:

{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[1.*, 3.0.0)"
  }
}

local.settings.json:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=myAzureAccountName;AccountKey=myAzureAccountKeyString==",
    "FUNCTIONS_WORKER_RUNTIME": "java"
  }
}

最佳答案

我缺少“local.setting.json”中的配置值,该值是我在 DI 服务的构造函数中使用的。通过添加这些值解决了我的问题。希望你也是如此。

关于java - Azure Functions, "System.Private.CoreLib: Value cannot be null. (Parameter ' 路径 1'). Value cannot be null. (Parameter ' 提供商')",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60747704/

相关文章:

Java创建一个新框架

java - 我试图在 java 中的 sqlite 嵌入式数据库中插入一行。插入后,更改仅在该程序中可见

python - 通过POST请求发送数据

java - 循环FileReader

c - 使用 libcurl 和 CURLFORM_STREAM 将多部分表单上传到 S3

http - Nginx 中的慢速 Http Post 攻击

gradle - 将环境变量从build.gradle传递到自定义插件

Android Studio 只为多模块项目中没有模块依赖的模块生成 R 文件

gradle - 如何将 Ant 片段转换为Gradle

java - 无法使用 FileReader 和 BufferedReader 在 Java 中读取文本文件