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

Java function host failed to discover main classes for spring cloud function #338

Open
Flanker32 opened this issue Dec 4, 2019 · 0 comments
Open

Comments

@Flanker32
Copy link

@Flanker32 Flanker32 commented Dec 4, 2019

Function host can't find the main class of spring cloud functions and report error. Both in azure services and local.

Investigative information

Function core tools 2.7.1948

Repro steps

  1. Prepare a spring cloud function project, could do it by git clone https://github.com/Azure-Samples/hello-spring-function-azure.git.
  2. Build the spring cloud function project by mvn clean package
  3. Invoke the function locally by mvn azure-functions:run.
    • This issue could also repo in service side, just remove the MAIN_CLASS settings in azure function configuration

Expected behavior

The main class of the function should be automatically found. The MAIN_CLASS property should not need to be specified and users could access the function by curl http://localhost:7071/api/hello -d "{\"name\":\"Azure\"}"

Actual behavior

No response from curl, function host reports

 java.lang.IllegalStateException: Failed to discover main class. An attempt was made to discover main class as 'MAIN_CLASS' environment variable, system property as well as entry in META-INF/MANIFEST.MF (in that order).

Known workarounds

Set the MAIN_CLASS in app settings, for local run, add a local.settings.json file with MAIN_CLASS specified

Related information

Referred microsoft/azure-maven-plugins#912

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.