Azure Java函数“添加的jar不存在。”

时间:2018-10-24 23:25:57

标签: java visual-studio-code azure-functions azure-functions-core-tools

当我尝试创建一个新的Java Azure Function项目时,我不断遇到有关丢失的.jar文件的以下错误。我已经验证了.jar文件的存在,并且我还验证了其正确命名。我只会在函数编译后收到此错误,然后尝试到达端点。我知道如果我重新创建该项目,则该错误会自行解决,但是我试图理解根本原因。

[10/24/18 11:10:10 PM] Executed 'Functions.HttpTrigger-Java' (Failed, Id=1111111-1111-1111-1111-EV0111d6f03)
[10/24/18 11:10:10 PM] System.Private.CoreLib: Exception while executing function: Functions.HttpTrigger-Java. System.Private.CoreLib: Result: Failure
[10/24/18 11:10:10 PM] Exception: IOException: The jar URL "file:/Users/USER/Documents/Workspace/FUNCTIONNAME/target/azure-functions/FUNCTIONNAME/FUNCTIONNAME-1.0.jar" being added does not exist.
[10/24/18 11:10:10 PM] Stack: java.io.IOException: The jar URL "file:/Users/USER/Documents/Workspace/FUNCTIONNAME/target/azure-functions/FUNCTIONNAME/FUNCTIONNAME-1.0.jar" being added does not exist.
[10/24/18 11:10:10 PM]  at com.microsoft.azure.functions.worker.reflect.DefaultClassLoaderProvider.addUrl(DefaultClassLoaderProvider.java:61)
[10/24/18 11:10:10 PM]  at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.addSearchPathsToClassLoader(JavaFunctionBroker.java:58)
[10/24/18 11:10:10 PM]  at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.loadMethod(JavaFunctionBroker.java:30)
[10/24/18 11:10:10 PM]  at com.microsoft.azure.functions.worker.handler.FunctionLoadRequestHandler.execute(FunctionLoadRequestHandler.java:27)
[10/24/18 11:10:10 PM]  at com.microsoft.azure.functions.worker.handler.FunctionLoadRequestHandler.execute(FunctionLoadRequestHandler.java:9)
[10/24/18 11:10:10 PM]  at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
[10/24/18 11:10:10 PM]  at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:91)
[10/24/18 11:10:10 PM]  at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
[10/24/18 11:10:10 PM]  at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
[10/24/18 11:10:10 PM]  at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
[10/24/18 11:10:10 PM]  at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
[10/24/18 11:10:10 PM]  at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
[10/24/18 11:10:10 PM] .

1 个答案:

答案 0 :(得分:2)

似乎Visual Studio Code无法正确处理文件路径中的空格。如果您从任何文件名/文件夹中删除空格,那么它应该可以解决此错误。