Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_function_app_function - Java function throws ClassNotFoundException for HTTP Trigger with code upload #16356

Open
1 task done
mateustanaka opened this issue Apr 12, 2022 · 2 comments
Labels

Comments

@mateustanaka
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 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

@github-actions github-actions bot removed the bug label Apr 12, 2022
@mateustanaka mateustanaka changed the title azurerm_function_app_function throws ClassNotFoundException for HTTP Trigger with code upload azurerm_function_app_function throws ClassNotFoundException for HTTP Trigger with code upload Apr 13, 2022
@mateustanaka mateustanaka changed the title azurerm_function_app_function throws ClassNotFoundException for HTTP Trigger with code upload azurerm_function_app_function - Java function throws ClassNotFoundException for HTTP Trigger with code upload Apr 13, 2022
@rcskosir rcskosir added the service/functions Function Apps label Jun 9, 2023
@rcskosir
Copy link
Contributor

rcskosir commented Sep 4, 2024

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?

@sunilr8
Copy link

sunilr8 commented Oct 6, 2024

@rcskosir i am running in to the same issue, using 4.3.0 version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants