Closed
Description
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
- Prepare a spring cloud function project, could do it by
git clone https://github.com/Azure-Samples/hello-spring-function-azure.git
. - Build the spring cloud function project by
mvn clean package
- 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
- This issue could also repo in service side, just remove the
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