在 Java 中使用 Visual Studio Code 的 Azure Functions 项目

2024-04-05

我正在尝试使用 VSCode 创建 azure 函数并将其部署到 azure。我按照官方文档的描述进行操作,

https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-vs-code?pivots=programming-language-java https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-vs-code?pivots=programming-language-java.

按照本文档中所述执行了所有操作,但在到达“部分”时按 F5 时出现错误在本地运行该函数'。我通过在互联网上搜索尝试了一些方法,但没有一个起作用。我注意到官方 github 帐户上早在 2017 年就报告了一个未解决的问题

https://github.com/Microsoft/function-demo-java-on-azure/issues/3 https://github.com/Microsoft/function-demo-java-on-azure/issues/3

这让我想知道这个问题还存在吗?

已经花了很多时间在这上面,但无法使其发挥作用。任何帮助表示赞赏

          Environment:
          VS Code: v1.44.0
          jdk 11.0.3
          node v12.16.1
          maven v3.6.3

使用命令 npm install -g azure-functions-core-tools@3 成功安装 azure function core 工具

这是完整的错误跟踪

INFO] --- azure-functions-maven-plugin:0.1.4:package (package-functions) @ azure-http-trigger-example ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  18.933 s
[INFO] Finished at: 2020-04-10T17:28:19-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:0.1.4:package (package-functions) on project azure-http-trigger-example: Execution package-functions of goal com.microsoft.azure:azure-functions-maven-plugin:0.1.4:package failed: A required class was missing while executing com.microsoft.azure:azure-functions-maven-plugin:0.1.4:package: javax/xml/bind/JAXBException
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>com.microsoft.azure:azure-functions-maven-plugin:0.1.4
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/maven/repository/com/microsoft/azure/azure-functions-maven-plugin/0.1.4/azure-functions-maven-plugin-0.1.4.jar
[ERROR] urls[1] = file:/C:/maven/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
[ERROR] urls[2] = file:/C:/maven/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.0/org.eclipse.sisu.inject-0.3.0.jar
[ERROR] urls[3] = file:/C:/maven/repository/org/apache/maven/maven-builder-support/3.3.3/maven-builder-support-3.3.3.jar
[ERROR] urls[4] = file:/C:/maven/repository/org/eclipse/aether/aether-util/1.0.2.v20150114/aether-util-1.0.2.v20150114.jar
[ERROR] urls[5] = file:/C:/maven/repository/org/sonatype/sisu/sisu-guice/3.2.5/sisu-guice-3.2.5-no_aop.jar
[ERROR] urls[6] = file:/C:/maven/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
[ERROR] urls[7] = file:/C:/maven/repository/org/codehaus/plexus/plexus-interpolation/1.21/plexus-interpolation-1.21.jar
[ERROR] urls[8] = file:/C:/maven/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[9] = file:/C:/maven/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[10] = file:/C:/maven/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[11] = file:/C:/maven/repository/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar
[ERROR] urls[12] = file:/C:/maven/repository/com/microsoft/azure/azure-maven-plugin-lib/0.1.4/azure-maven-plugin-lib-0.1.4.jar
[ERROR] urls[13] = file:/C:/maven/repository/org/apache/maven/shared/maven-filtering/3.0.0/maven-filtering-3.0.0.jar
[ERROR] urls[14] = file:/C:/maven/repository/org/apache/maven/shared/maven-shared-utils/3.0.0/maven-shared-utils-3.0.0.jar
[ERROR] urls[15] = file:/C:/maven/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
[ERROR] urls[16] = file:/C:/maven/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
[ERROR] urls[17] = file:/C:/maven/repository/com/microsoft/azure/azure/1.2.1/azure-1.2.1.jar
[ERROR] urls[18] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-resources/1.2.1/azure-mgmt-resources-1.2.1.jar
[ERROR] urls[19] = file:/C:/maven/repository/org/slf4j/slf4j-simple/1.7.5/slf4j-simple-1.7.5.jar
[ERROR] urls[20] = file:/C:/maven/repository/io/reactivex/rxjava/1.2.4/rxjava-1.2.4.jar
[ERROR] urls[21] = file:/C:/maven/repository/org/apache/httpcomponents/httpcore/4.4.5/httpcore-4.4.5.jar
[ERROR] urls[22] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-storage/1.2.1/azure-mgmt-storage-1.2.1.jar
[ERROR] urls[23] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-network/1.2.1/azure-mgmt-network-1.2.1.jar
[ERROR] urls[24] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-compute/1.2.1/azure-mgmt-compute-1.2.1.jar
[ERROR] urls[25] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-graph-rbac/1.2.1/azure-mgmt-graph-rbac-1.2.1.jar
[ERROR] urls[26] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-keyvault/1.2.1/azure-mgmt-keyvault-1.2.1.jar
[ERROR] urls[27] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-batch/1.2.1/azure-mgmt-batch-1.2.1.jar
[ERROR] urls[28] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-trafficmanager/1.2.1/azure-mgmt-trafficmanager-1.2.1.jar
[ERROR] urls[29] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-dns/1.2.1/azure-mgmt-dns-1.2.1.jar
[ERROR] urls[30] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-redis/1.2.1/azure-mgmt-redis-1.2.1.jar
[ERROR] urls[31] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-appservice/1.2.1/azure-mgmt-appservice-1.2.1.jar
[ERROR] urls[32] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-cdn/1.2.1/azure-mgmt-cdn-1.2.1.jar
[ERROR] urls[33] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-sql/1.2.1/azure-mgmt-sql-1.2.1.jar
[ERROR] urls[34] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-containerregistry/1.2.1/azure-mgmt-containerregistry-1.2.1.jar
[ERROR] urls[35] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-cosmosdb/1.2.1/azure-mgmt-cosmosdb-1.2.1.jar
[ERROR] urls[36] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-search/1.2.1/azure-mgmt-search-1.2.1.jar
[ERROR] urls[37] = file:/C:/maven/repository/com/microsoft/azure/azure-mgmt-servicebus/1.2.1/azure-mgmt-servicebus-1.2.1.jar
[ERROR] urls[38] = file:/C:/maven/repository/joda-time/joda-time/2.1/joda-time-2.1.jar
[ERROR] urls[39] = file:/C:/maven/repository/com/microsoft/azure/azure-client-runtime/1.1.0/azure-client-runtime-1.1.0.jar
[ERROR] urls[40] = file:/C:/maven/repository/com/microsoft/rest/client-runtime/1.1.0/client-runtime-1.1.0.jar
[ERROR] urls[41] = file:/C:/maven/repository/com/squareup/retrofit2/retrofit/2.1.0/retrofit-2.1.0.jar
[ERROR] urls[42] = file:/C:/maven/repository/com/squareup/okhttp3/okhttp/3.3.1/okhttp-3.3.1.jar
[ERROR] urls[43] = file:/C:/maven/repository/com/squareup/okio/okio/1.8.0/okio-1.8.0.jar
[ERROR] urls[44] = file:/C:/maven/repository/com/squareup/okhttp3/logging-interceptor/3.3.1/logging-interceptor-3.3.1.jar
[ERROR] urls[45] = file:/C:/maven/repository/com/squareup/okhttp3/okhttp-urlconnection/3.3.1/okhttp-urlconnection-3.3.1.jar
[ERROR] urls[46] = file:/C:/maven/repository/com/squareup/retrofit2/converter-jackson/2.1.0/converter-jackson-2.1.0.jar
[ERROR] urls[47] = file:/C:/maven/repository/com/fasterxml/jackson/core/jackson-databind/2.7.2/jackson-databind-2.7.2.jar
[ERROR] urls[48] = file:/C:/maven/repository/com/fasterxml/jackson/datatype/jackson-datatype-joda/2.7.2/jackson-datatype-joda-2.7.2.jar
[ERROR] urls[49] = file:/C:/maven/repository/com/fasterxml/jackson/core/jackson-annotations/2.7.0/jackson-annotations-2.7.0.jar
[ERROR] urls[50] = file:/C:/maven/repository/com/squareup/retrofit2/adapter-rxjava/2.1.0/adapter-rxjava-2.1.0.jar
[ERROR] urls[51] = file:/C:/maven/repository/com/microsoft/azure/azure-client-authentication/1.1.0/azure-client-authentication-1.1.0.jar
[ERROR] urls[52] = file:/C:/maven/repository/com/microsoft/azure/adal4j/1.1.2/adal4j-1.1.2.jar
[ERROR] urls[53] = file:/C:/maven/repository/com/nimbusds/oauth2-oidc-sdk/4.5/oauth2-oidc-sdk-4.5.jar
[ERROR] urls[54] = file:/C:/maven/repository/javax/mail/mail/1.4.7/mail-1.4.7.jar
[ERROR] urls[55] = file:/C:/maven/repository/javax/activation/activation/1.1/activation-1.1.jar
[ERROR] urls[56] = file:/C:/maven/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar
[ERROR] urls[57] = file:/C:/maven/repository/net/minidev/json-smart/1.1.1/json-smart-1.1.1.jar
[ERROR] urls[58] = file:/C:/maven/repository/com/nimbusds/lang-tag/1.4/lang-tag-1.4.jar
[ERROR] urls[59] = file:/C:/maven/repository/com/nimbusds/nimbus-jose-jwt/3.1.2/nimbus-jose-jwt-3.1.2.jar
[ERROR] urls[60] = file:/C:/maven/repository/org/bouncycastle/bcprov-jdk15on/1.51/bcprov-jdk15on-1.51.jar
[ERROR] urls[61] = file:/C:/maven/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar
[ERROR] urls[62] = file:/C:/maven/repository/commons-codec/commons-codec/1.10/commons-codec-1.10.jar
[ERROR] urls[63] = file:/C:/maven/repository/com/microsoft/azure/azure-annotations/1.2.0/azure-annotations-1.2.0.jar
[ERROR] urls[64] = file:/C:/maven/repository/com/microsoft/azure/applicationinsights-core/1.0.9/applicationinsights-core-1.0.9.jar
[ERROR] urls[65] = file:/C:/maven/repository/eu/infomas/annotation-detector/3.0.4/annotation-detector-3.0.4.jar
[ERROR] urls[66] = file:/C:/maven/repository/commons-io/commons-io/2.4/commons-io-2.4.jar
[ERROR] urls[67] = file:/C:/maven/repository/org/apache/httpcomponents/httpclient/4.5.3/httpclient-4.5.3.jar
[ERROR] urls[68] = file:/C:/maven/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar
[ERROR] urls[69] = file:/C:/maven/repository/commons-net/commons-net/3.6/commons-net-3.6.jar
[ERROR] urls[70] = file:/C:/maven/repository/com/microsoft/azure/azure-functions-java-core/1.0.0-beta-1/azure-functions-java-core-1.0.0-beta-1.jar
[ERROR] urls[71] = file:/C:/maven/repository/org/reflections/reflections/0.9.11/reflections-0.9.11.jar
[ERROR] urls[72] = file:/C:/maven/repository/com/google/guava/guava/20.0/guava-20.0.jar
[ERROR] urls[73] = file:/C:/maven/repository/org/javassist/javassist/3.21.0-GA/javassist-3.21.0-GA.jar
[ERROR] urls[74] = file:/C:/maven/repository/com/microsoft/azure/azure-storage/5.4.0/azure-storage-5.4.0.jar
[ERROR] urls[75] = file:/C:/maven/repository/com/fasterxml/jackson/core/jackson-core/2.6.0/jackson-core-2.6.0.jar
[ERROR] urls[76] = file:/C:/maven/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar
[ERROR] urls[77] = file:/C:/maven/repository/com/microsoft/azure/azure-keyvault-core/0.8.0/azure-keyvault-core-0.8.0.jar
[ERROR] urls[78] = file:/C:/maven/repository/org/zeroturnaround/zt-zip/1.12/zt-zip-1.12.jar
[ERROR] urls[79] = file:/C:/maven/repository/junit/junit/4.12/junit-4.12.jar
[ERROR] urls[80] = file:/C:/maven/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : javax.xml.bind.JAXBException
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.


原来是java版本不兼容的问题。目前azure函数仅支持JDK8,但我使用JDK11。切换到正确的java版本后,问题解决。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 Java 中使用 Visual Studio Code 的 Azure Functions 项目 的相关文章

随机推荐

  • 使用 Java 从 Google Drive 获取列表文件 [关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 有关您编写的代码的问题必须描述具体问题 and 包含有效代码重现它 在问题本身中 看SSCCE org http sscce org 以获
  • 闪亮的滑块限制释放鼠标左键的反应

    我正在使用 Shiny 应用程序 其中可能需要一些时间才能将滑块设置为正确的值 因此 在尝试将滑块设置为正确的值 并且不释放鼠标左键 时 即我的本地 服务器观察到几个新值并做出相应反应 由于我的服务器对任何新值的响应可能需要几秒钟 如果我可
  • 有没有一种方法可以有效地生成包含数百万个文件的目录中的每个文件?

    我知道os listdir 但据我所知 它将目录中的所有文件名放入内存 然后返回列表 我想要的是一种生成文件名 对其进行处理 然后生成下一个文件名的方法 而不会将它们全部读入内存 有什么办法可以做到这一点吗 我担心使用这种方法更改文件名 添
  • Rails 4.0 中的多个“root to”路线

    我试图让 Rails 根据子域转到不同的控制器 action 这就是我迄今为止在routes rb中所拥有的 Petworkslabs Application routes draw do get to custom show constr
  • R 并排分组箱线图

    我有两种植物气体排放的时间数据 这两种植物都经过了相同的处理 和一些以前的帮助 https stackoverflow com questions 23848186 unify boxplot factor group colours 23
  • Oauth 2.0 - 单个资源服务器但多个客户端应用程序

    问候 我想问以下是否是 Oauth 2 0 的有效用例 授权服务器 单独 单个 或多个 资源服务器 多个客户端应用程序访问同一资源服务器 如果这是一个有效的用例 我们如何使用授权服务器配置多个客户端 无法使用 application pro
  • 如何用 SUBSTITUTE 公式替换 Excel 中的引号?

    我有工作表 其中需要命名范围来对应于另一个单元格的内容 单元格中的文本类似于 Partitions w Studs 16 oc 命名范围不能包含空格 或者最重要的是 不能包含 等特殊字符 因此 该范围的命名如下 PartitionswStu
  • clojure lein(读取行)stdin 问题

    所以常规的 clojure repl 工作得很好 read line 收集输入 然后回显它 使用lein repl但是 它永远不会回显任何输入字符 也不允许我从任何标准输入读取命令返回 我确信这与重新绑定有关in 但想知道是否有解决方法 修
  • Tablayout+view 分页器未在位置 0 显示片段

    我的应用程序有 2 个选项卡 具有两种不同的布局 当我运行应用程序时 应该在 tab1 位置 0 中显示的片段显示在 tab2 中 而应该在 tab2 位置 1 中显示的片段没有显示 此外 当我滑动屏幕时 选项卡布局中的选项卡焦点不会改变
  • PDF - 设置受密码保护的打印、复制、粘贴选项?

    我正在寻找一个 Python 库 它允许我在现有 PDF 文件上设置受密码保护的打印 复制 粘贴选项 我尝试过的 我查看了reportlab pdfencrypt模块 这正是我需要的选项 但是开源版本受到严格限制 甚至无法设置真正的密码 并
  • iOs(CoreLocation)-locationManager:didUpdateLocations:未按预期工作

    我编写了一个简单的 iPhone 应用程序 用于检索位置信息并简单地显示它们 我想增加distanceTraveled每次位置改变时都会变量 我的问题是在方法中locationManager CLLocationManager manage
  • 对.net中多重继承的质疑

    我们知道 net中所有的类都是继承自对象类的 假设我们创建一个名为 ClassA 的类 然后我们创建另一个类 名为ClassB 它继承自ClassA 这不是多重继承吗 因为ClassB同时继承自Object类和ClassA 这不是违反了C
  • 如何以编程方式从 Office 文件中提取和操作图像?

    如何从 PowerPoint 和 Word 文档中提取一些图像 以便对其进行操作 然后将图像放回 MS Office 文件中 Apache 有一个名为 POI 的项目 专门用于与 Java 中的 MS Office 格式进行交互 希望这对你
  • 从 cygwin bash 成功克隆后,本地 Git 存储库不存在

    当我克隆到通过绝对路径引用的目录 不存在 时 git 不会抱怨任何事情 报告 0 退出代码 但目录是not创建的 Git 遵守目录do当我重试时存在 user host tmp git clone https github com zand
  • com.mongodb.MongoSocketOpenException:打开套接字时出现异常(MongoDB、Docker)

    我尝试使用 docker 映像启动我的应用程序 Spring Boot Spring Cloud Eureka MongoDB 但无法连接到 MongoDB 例外 exception com mongodb MongoSocketOpenE
  • 解决电力塔

    a 2 Power 10 6 10 9 3 Power 4 9 7 5 TwoTower n Nest 2 1 n 最小的是什么n这样TwoTower n gt a This question http www quora com How
  • 如何给 git 仓库命名?

    我正在使用这些命令创建远程仓库 mkdir NewRepo cd NewRepo git init 然后我将此存储库克隆到本地 git clone user server path to app git 这对我有用 但我想给仓库命名 像其他
  • 我如何监听所有具有参数化名称的 Seam 上下文事件?

    接缝会起火不同类型的事件 http docs jboss org seam latest reference en US html events html d0e5252与特定范围 任务或流程相关 并将范围 任务或流程的名称附加到事件末尾
  • 获取两个给定日期之间的 SUM

    如果我想获得一定日期范围内的总消耗量 我该怎么做 我想我可以这样做 SELECT id SUM consumption FROM consumption info WHERE date time BETWEEN 2013 09 15 AND
  • 在 Java 中使用 Visual Studio Code 的 Azure Functions 项目

    我正在尝试使用 VSCode 创建 azure 函数并将其部署到 azure 我按照官方文档的描述进行操作 https learn microsoft com en us azure azure functions functions cr