terraform-provider-azurerm
terraform-provider-azurerm copied to clipboard
`azurerm_function_app_function` - Java function throws ClassNotFoundException for HTTP Trigger with code upload
Is there an existing issue for this?
- [X] I have searched the existing issues
Community Note
- Please vote on this issue by adding a :thumbsup: reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform Version
1.1.0
AzureRM Provider Version
3.0.2
Affected Resource(s)/Data Source(s)
azurerm_function_app_function
Terraform Configuration Files
resource "azurerm_function_app_function" "default" {
name = "MyAzureFunction"
function_app_id = azurerm_linux_function_app.default.id
language = "Java"
file {
name = "my-java-app-1.0-SNAPSHOT.jar"
content = filebase64("my-java-app-1.0-SNAPSHOT.jar")
}
config_json = jsonencode({
"scriptFile" : "my-java-app-1.0-SNAPSHOT.jar",
"entryPoint" : "com.mypackage.MyClass.runEvent",
"bindings" : [
{
"type" : "eventGridTrigger",
"direction" : "in",
"name" : "eventGridEvent"
}
]
})
}
Debug Output/Panic Output
Result: Failure Exception: ClassNotFoundException: com.mypackage.MyClass Stack: java.lang.ClassNotFoundException: com.mypackage.MyClass
java.base/java.net.URLClassLoader.findClass(Unknown Source)
java.base/java.lang.ClassLoader.loadClass(Unknown Source)
java.base/java.lang.ClassLoader.loadClass(Unknown Source)
java.base/java.lang.Class.forName0(Native Method)
java.base/java.lang.Class.forName(Unknown Source)
com.microsoft.azure.functions.worker.broker.EnhancedJavaMethodExecutorImpl.getContainingClass(EnhancedJavaMethodExecutorImpl.java:63)
com.microsoft.azure.functions.worker.broker.EnhancedJavaMethodExecutorImpl.<init>(EnhancedJavaMethodExecutorImpl.java:22)
com.microsoft.azure.functions.worker.broker.FactoryJavaMethodExecutor.getJavaMethodExecutor(FactoryJavaMethodExecutor.java:20)
com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.loadMethod(JavaFunctionBroker.java:35)
com.microsoft.azure.functions.worker.handler.FunctionLoadRequestHandler.execute(FunctionLoadRequestHandler.java:27)
com.microsoft.azure.functions.worker.handler.FunctionLoadRequestHandler.execute(FunctionLoadRequestHandler.java:9)
com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92)
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
java.base/java.util.concurrent.FutureTask.run(Unknown Source)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.base/java.lang.Thread.run(Unknown Source)
Expected Behaviour
Azure Java Function code executed and message processed
Actual Behaviour
Result: Failure Exception: ClassNotFoundException: com.mypackage.MyClass
Steps to Reproduce
No response
Important Factoids
No response
References
https://registry.terraform.io/providers/hashicorp/azurerm/3.0.2/docs/resources/function_app_function#example-usage---http-trigger-with-code-upload
Thanks for opening this issue. Have you been able to try this on any of the more recent 3.x versions or on the new 4.x versions to see if this issue still persists?
@rcskosir i am running in to the same issue, using 4.3.0 version