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

Can not run java azure function locally, created using maven archetype:generate given on microsoft site using mvn azure-functions:run, not showing error. Its simply freezing. #167

Open
sarojbala123 opened this issue Mar 25, 2021 · 5 comments

Comments

@sarojbala123
Copy link

sarojbala123 commented Mar 25, 2021

Followed every step and verified many times mentioned in below link:
https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-java?tabs=bash%2Cazure-cli%2Cbrowser
Below is screenshot of cmd running mvn azure-functions:run command
image

I tried to run mvn azure-functions:run -X and its showing below and freezing:
image

@Iuzuz
Copy link

Iuzuz commented Mar 26, 2021

I had the issue, too.
Steps to reproduce (at least in my case):

  • windows, java 8, mvn 3.3.3
  • mvn archetype:generate -DarchetypeGroupId=com.microsoft.azure -DarchetypeArtifactId=azure-functions-archetype -DarchetypeVersion=1.35 -DgroupId=com.bla.function -Dversion=0.1-SNAPSHOT -DartifactId=arch-function
    -> results in [INFO] BUILD SUCCESS
  • cd arch-function
  • mvn package
    -> results in [INFO] BUILD SUCCESS
  • mvn azure-functions:run -X
    -> results on stopping at:
    [INFO] Azure Function App's staging directory found at: V:\V1420-Microservices\arch-function\target\azure-functions\arch-function-20210326092331413
    [DEBUG] Executing command: func

If I try to "cd" to the staging directory and call "func start"
then -> it works!

[2021-03-26T08:26:37.096Z] Job host started

Functions:

    HttpExample: [GET,POST] http://localhost:7071/api/HttpExample

(...Maybe this is a workaround)

I tried to inspect the running process with the jconsole. The main thread is blocked at:

Name: main
State: RUNNABLE
Total blocked: 75 Total waited: 2

Stack trace:
java.lang.ProcessImpl.waitForInterruptibly(Native Method)
java.lang.ProcessImpl.waitFor(ProcessImpl.java:449)
com.microsoft.azure.common.function.handlers.CommandHandlerImpl.runCommand(CommandHandlerImpl.java:80)
com.microsoft.azure.common.function.handlers.CommandHandlerImpl.runCommandWithReturnCodeCheck(CommandHandlerImpl.java:32)
com.microsoft.azure.maven.function.RunMojo.checkRuntimeExistence(RunMojo.java:90)
com.microsoft.azure.maven.function.RunMojo.doExecute(RunMojo.java:74)
com.microsoft.azure.maven.AbstractAzureMojo.execute(AbstractAzureMojo.java:466)
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

.... maybe this helps somehow

@Iuzuz
Copy link

Iuzuz commented Mar 26, 2021

Maybe this is related to the maven plugin and not to the archetype
https://github.com/microsoft/azure-maven-plugins

@sarojbala123
Copy link
Author

Thanks a lot luzuz! I am extremely thankful to you.it worked the way you mentioned. I was struggling since 2 days as I am new to azure functions.
Is it going to work fine like for all java azure functions httpTrigger,timeTrigger etc. And also will it work fine while publishing to azure ?

@Flanker32
Copy link
Member

Flanker32 commented Mar 27, 2021

@Luzuz Thanks a lot for your comment.

@sarojbala123 Thanks for your report and really sorry for the trouble. We meet some compatibility issues with the latest function core tools. The issue has been addressed in microsoft/azure-maven-plugins#1367, will be shipped in functions maven plugin 1.10.0. Before the release, you may use core tools 3.0.3331 or previous version or invoke func host start in staging folder as a workaround.

@sarojbala123
Copy link
Author

I also tried running Spring boot azure function using TimeTrigger by following below steps:
Followed every step and verified many times mentioned in below link:
https://docs.microsoft.com/en-us/azure/developer/java/spring-framework/getting-started-with-spring-cloud-function-in-azure

instead of HttpTrigger I used TimeTrigger
image

Its showing a new error now as shown below: I have used local.setting.json properties as shown
image

image

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

No branches or pull requests

3 participants