Már*_*roš 5 java azure maven azure-functions serverless
我正在尝试使用 IntelliJ 在我的 mac 上本地运行 Azure 函数。我做了一切,在本教程中一步一步:https : //docs.microsoft.com/en-us/azure/azure-functions/functions-create-maven-intellij但是当我启动项目控制台时显示错误
`Azure Functions Core Tools (3.0.2912 Commit hash: bfcbbe48ed6fdacdf9b309261ecc8093df3b83f2)
Function Runtime Version: 3.0.14287.0
Failed to start Worker Channel. Process fileName: %JAVA_HOME%/bin/java
System.Diagnostics.Process: No such file or directory.
Failed to start language worker process for runtime: (null). workerId:9c6a8dfb-6dcc-4e3c-82a6-0ce0c6949991
No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
For detailed output, run func with --verbose flag.
Hosting environment: Production
Content root path: /Users/mariojaros/Library/Mobile Documents/com~apple~CloudDocs/azure-function-examples
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
Host lock lease acquired by instance ID '00000000000000000000000086CB0170'.
^CApplication is shutting down...
Run Code Online (Sandbox Code Playgroud)
` 我认为问题出在语言工作者身上。
JAVA_主页:
which java
/usr/bin/java
Run Code Online (Sandbox Code Playgroud)
我也在尝试 func start 并且结果相同,最后我用 Visual Studio 代码和相同的错误尝试了它。
我在java中本地运行Azure函数的唯一方法是当我用原型生成项目mvn archetype:generate -DarchetypeGroupId=com.microsoft.azure -DarchetypeArtifactId=azure-functions-archetype -DjavaVersion=8
然后mvn package
mvn azurefunctions:run
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< sk.devy:rendering-skuska >----------------------
[INFO] Building Azure Java Functions 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- azure-functions-maven-plugin:1.4.0:run (default-cli) @ rendering-skuska ---
[WARNING] Azure Functions only support JDK 8, which is lower than local JDK version 14.0.1
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.microsoft.applicationinsights.core.dependencies.xstream.core.util.Fields (file:/Users/mariojaros/.m2/repository/com/microsoft/azure/applicationinsights-core/2.5.1-BETA/applicationinsights-core-2.5.1-BETA.jar) to field java.util.TreeMap.comparator
WARNING: Please consider reporting this to the maintainers of com.microsoft.applicationinsights.core.dependencies.xstream.core.util.Fields
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Azure Function App's staging directory found at: /Users/mariojaros/rendering-skuska/target/azure-functions/rendering-skuska-1600871852849
[INFO] Azure Functions Core Tools found.
Azure Functions Core Tools (3.0.2912 Commit hash: bfcbbe48ed6fdacdf9b309261ecc8093df3b83f2)
Function Runtime Version: 3.0.14287.0
Worker process started and initialized.
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Functions:
HttpTrigger-Java: [GET,POST] http://localhost:7071/api/HttpTrigger-Java
For detailed output, run func with --verbose flag.
Hosting environment: Production
Content root path: /Users/mariojaros/rendering-skuska/target/azure-functions/rendering-skuska-1600871852849
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
Host lock lease acquired by instance ID '000000
Run Code Online (Sandbox Code Playgroud)
有人有相关问题吗?func start 是否适用于 java 函数?
Caj*_*ing 21
在新笔记本电脑上安装带有 Azure Toolkit for IntelliJ 插件的最新版本 IDEA IntelliJ 以及带有现有项目的 Azure Core Tools v3 后,我开始收到此错误。
本地运行 Azure Functions 时控制台中的第一个错误是:
Failed to start Worker Channel. Process fileName: %JAVA_HOME%/bin/java
因此,对于使用 IntelliJ 和 Azure Functions 出现此错误的任何人,可以在配置的运行/调试配置中设置 JAVA_HOME Run Functions
。
只需将其添加到应用程序设置中,并指向 Java 根文件夹的正确位置即可。
例如,在 Windows 上,如果您安装了 Azure 支持的 SDK v11(LTS 版本)(又名 Zulu v11 for Azure),那么它将安装到位于完全限定路径中的主
C:\Program Files\Zulu\zulu-11
路径java.exe
中C:\Program Files\Zulu\zulu-11\bin\java.exe
因此,您需要添加键值对: Key= "JAVA_HOME" Value = "C:\Program Files\Zulu\zulu-11"
小智 10
我遇到了这个问题,发现 zeretbird 提供的解决方案几乎对我有用。但我必须像这样将 JAVA_HOME 和路径放入 local.setting.json 中。
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "java",
"StoreServiceendpoint": "blabla",
"StoreServiceKey": "blabla",
"JAVA_HOME": "/Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home"
}
}
Run Code Online (Sandbox Code Playgroud)
语言工作者java的Java路径worker.config.json
在安装目录的配置文件中设置azure-function-core-tools@3/%version/workers/java
{
"description": {
"language": "java",
"extensions": [".jar"],
"defaultExecutablePath": "/usr/bin/java",
"defaultWorkerPath": "azure-functions-java-worker.jar",
"arguments": ["-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -noverify -Djava.net.preferIPv4Stack=true -jar", "%JAVA_OPTS%"]
}
}
Run Code Online (Sandbox Code Playgroud)
您需要将defaultExecutablePath从更改"%JAVA_HOME%/bin/java
为 java 可执行文件的绝对路径(例如/usr/bin/java
)。
你可以找到安装目录 readlink -f $(which func)
您可以在 VS Code 中的 local.settings.json 中添加 JAVA_HOME。
这是一个例子。操作系统:WSL Ubuntu-20.04 代码编辑器:VS Code
{
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "java",
"JAVA_HOME": "/usr"
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4041 次 |
最近记录: |