Giter Club home page Giter Club logo

hello-spring-function-azure's Introduction

page_type languages products description urlFragment
sample
java
azure
This is a sample application to showcase the use of Spring Cloud Function on top of Azure Functions.
hello-spring-function-azure

Example "Hello, world" Spring Boot application that runs on Azure Functions

This is a sample application to showcase the use of Spring Cloud Function on top of Azure Functions.

Features

This is just a "Hello, world", but it uses domain objects so it's easy to extend to do something more complex.

Getting Started

Prerequisites

This project uses the Maven Wrapper, so all you need is Java installed.

Installation

  • Clone the project: git clone https://github.com/Azure-Samples/hello-spring-function-azure.git
  • Configure the project to use your own resource group and your own application name (it should be unique across Azure)
    • Open the pom.xml file
    • Customize the functionResourceGroup and functionAppName properties
  • Build the project: ./mvnw clean package

Quickstart

Once the application is built, you can run it locally using the Azure Function Maven plug-in:

./mvnw azure-functions:run

And you can test it using a cURL command:

curl http://localhost:7071/api/hello -d '{"name": "Azure"}'

Deploying to Azure Functions

Deploy the application on Azure Functions with the Azure Function Maven plug-in:

./mvnw azure-functions:deploy

You can then test the running application, by running a POST request:

curl https://<YOUR_SPRING_FUNCTION_NAME>.azurewebsites.net/api/hello -d '{"name": "Azure"}'

Or a GET request:

curl https://<YOUR_SPRING_FUNCTION_NAME>.azurewebsites.net/api/hello?name=Azure

Replace the <YOUR_SPRING_FUNCTION_NAME> part by the name of your Spring Function.

hello-spring-function-azure's People

Contributors

andy-crain-kr avatar florentbo avatar jdubois avatar kaibocai avatar microsoftopensource avatar msftgits avatar sandraahlgrimm avatar v-hearya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hello-spring-function-azure's Issues

EventHubTrigger not working with Spring Cloud

I’am working on integrating the Azure EventHubTrigger Function with Spring Cloud Functions. I followed the below link which explains how HttpTrigger Function delegates the request to Spring Cloud. https://docs.microsoft.com/en-us/azure/developer/java/spring-framework/getting-started-with-spring-cloud-function-in-azure When I try the same with EventHubTrigger, I get “Exception: IllegalStateException: No function defined”. Below is the screenshot of the log.

image
image
image

Type convertion issue

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ x ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

I have created a FunctionHandler as below

public class SendToDynamicsHandler extends FunctionInvoker<VendorIdentifier, BRParty> {

    @FunctionName("processVendor")
    public HttpResponseMessage execute(
            @HttpTrigger(name = "request", methods = {HttpMethod.GET, HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<VendorIdentifier>> request,
            ExecutionContext context) {
        VendorIdentifier vendorIdentifier = request.getBody().get();
        context.getLogger().info("Vendor Id" + vendorIdentifier.getPartyId());
        return request
                .createResponseBuilder(HttpStatus.OK)
                .body(handleRequest(vendorIdentifier, context))
                .header("Content-Type", "application/json")
                .build();
    }
}

and the VendorIdentifier POJO as

public class VendorIdentifier {
	
	@JsonProperty("party_id")
	private String partyId;
	
	@JsonProperty("status")
	private String status;

	public String getPartyId() {
		return partyId;
	}

	public void setPartyId(String partyId) {
		this.partyId = partyId;
	}

        public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}
}

The payload sent to the function as

{
    "party_id": "VEN1234",
    "status": "APPROVED"
}

I see a type conversion issue when the function receives the parameter HttpRequestMessage<Optional<VendorIdentifier>> request. The partyId property is not populated in the VendorIdentifier and value is null. The status maps correctly as there is no difference between payload and the property in the pojo.

I have marked partyId using the jackson @JsonProperty annotation to handle mapping of the payload containing party_id field into partyId property, but it does not happen.

Any log messages given by the failure

None

Expected/desired behavior

Jackson annotations should be enforced and POJO mapped properly during type conversion

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Windows 10.

Versions

Azure Functions CLI installed locally - v4.0.4544

Mention any other details that might be useful

Project built using maven as in the sample.


Thanks! We'll be in touch soon.

Use Mono in the samples

The sample uses Spring WebFlux, so the functions should return asynchronously using Mono.

AZURE SPRING CLOUD FUNCTION IN DOCKER

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

This is my Dockerfile:

ARG JAVA_VERSION=11
FROM mcr.microsoft.com/azure-functions/java:4.0-java$JAVA_VERSION-build AS installer-env

COPY . /src/java-function-app
RUN cd /src/java-function-app && \
    mkdir -p /home/site/wwwroot && \
    mvn clean package -Dmaven.test.skip=true && \
    cd ./target/azure-functions/ && \
    cd $(ls -d */|head -n 1) && \
    cp -a . /home/site/wwwroot

FROM mcr.microsoft.com/azure-functions/java:4.0-java$JAVA_VERSION

ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true

EXPOSE 80
COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]

Any log messages given by the failure

This is the error that i received during Build Docker Image step:

Error:  Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.21.0:package (package-functions) on project afm-utils: Local Azure Functions Core Tools does not exist or is too old to support function extension installation, skip package phase. To install or update it, see: https://aka.ms/azfunc-install -> [Help 1]
Error:  
Error:  To see the full stack trace of the errors, re-run Maven with the -e switch.
Error:  Re-run Maven using the -X switch to enable full debug logging.
Error:  
Error:  For more information about the errors and possible solutions, please read the following articles:
Error:  [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The command '/bin/sh -c cd /src/java-function-app &&     mkdir -p /home/site/wwwroot &&     mvn clean package -Dmaven.test.skip=true &&     cd ./target/azure-functions/ &&     cd $(ls -d */|head -n 1) &&     cp -a . /home/site/wwwroot' returned a non-zero code: 1
Error: Process completed with exit code [1](https://github.com/pagopa/pagopa-afm-utils/actions/runs/3758664107/jobs/6387273175#step:5:1).

Expected/desired behavior

Deploy the application in the docker container

OS and Version?

Linux (ubuntu-18.04)

Versions

18.04

Mention any other details that might be useful

This is my host.json file

{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[3.*, 4.0.0)"
  },
  "logging": {
    "fileLoggingMode": "always",
    "logLevel": {
      "default": "Information",
      "Host.Results": "Error",
      "Function": "Information",
      "Host.Aggregator": "Trace"
    },
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": false
    }
  }
}
}

any suggestion?


Thanks! We'll be in touch soon.

HttpTrigger requests bypass handler and invoke function directly

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report 
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

git clone https://github.com/Azure-Samples/hello-spring-function-azure
run DemoApplication in IntelliJ 2021.2.2 Ultimate
Log messages in handler method does not appear in console

Any log messages given by the failure


>   .   ____          _            __ _ _
>  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
> ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
>  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
>   '  |____| .__|_| |_|_| |_\__, | / / / /
>  =========|_|==============|___/=/_/_/_/
>  :: Spring Boot ::                (v2.5.4)
> 
> 2021-10-08 12:44:25.670  INFO 61943 --- [           main] com.example.DemoApplication              : Starting DemoApplication using Java 11.0.10 on Shaheds-MBP with PID 61943 (/Users/sbsatter/Development/IntelliJ/hello-spring-function-azure/target/classes started by sbsatter in /Users/sbsatter/Development/IntelliJ/hello-spring-function-azure)
> 2021-10-08 12:44:25.679  INFO 61943 --- [           main] com.example.DemoApplication              : No active profile set, falling back to default profiles: default
> 2021-10-08 12:44:26.317  INFO 61943 --- [           main] o.s.c.f.web.flux.FunctionHandlerMapping  : FunctionCatalog: org.springframework.cloud.function.context.catalog.BeanFactoryAwareFunctionRegistry@103082dd
> 2021-10-08 12:44:26.474  INFO 61943 --- [           main] o.s.b.web.embedded.netty.NettyWebServer  : Netty started on port 8080
> 2021-10-08 12:44:26.485  INFO 61943 --- [           main] com.example.DemoApplication              : Started DemoApplication in 1.126 seconds (JVM running for 2.174)
> 
> Process finished with exit code 130 (interrupted by signal 2: SIGINT)
> 

Expected/desired behavior

Handler should be invoked before handleRequest(...) is invoked.

OS and Version?

MacOS 11.5.2

Versions

    azure.functions.java.library.version = 1.4.2
    azure.functions.maven.plugin.version = 1.13.0

Mention any other details that might be useful


Caused by: java.lang.NullPointerException: Cannot invoke "org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry$FunctionInvocationWrapper.apply(Object)" because "function" is null

I'm getting this error:

Caused by: java.lang.NullPointerException: Cannot invoke "org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry$FunctionInvocationWrapper.apply(Object)" because "function" is null

I didn't modify anything, just ran the code from the repo
Console log: https://pastebin.com/W2EbkDV4

Video

Main class can't be found

Report type

  • bug report
  • feature request
  • documentation issue or request
  • [] regression

Minimal steps to reproduce

download repo via git and go to the source code
run mvn clean build
run mvn azure-functions:run
try calling function via curl -v http://localhost:7071/api/hello

Any log messages given by the failure

[12/14/2019 3:14:12 PM] Executed 'Functions.hello' (Failed, Id=40bb9d77-8a49-404c-98d6-c2ee5abeaaa5)
[12/14/2019 3:14:12 PM] System.Private.CoreLib: Exception while executing function: Functions.hello. System.Private.CoreLib: Result: Failure
[12/14/2019 3:14:12 PM] Exception: IllegalArgumentException: Failed to locate main class
[12/14/2019 3:14:12 PM] Stack: 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).
[12/14/2019 3:14:12 PM] at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.getStartClass(AbstractSpringFunctionAdapterInitializer.java:288)
[12/14/2019 3:14:12 PM] at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.(AbstractSpringFunctionAdapterInitializer.java:100)
[12/14/2019 3:14:12 PM] at org.springframework.cloud.function.adapter.azure.AzureSpringBootRequestHandler.(AzureSpringBootRequestHandler.java:44)
[12/14/2019 3:14:12 PM] at com.example.HelloHandler.(HelloHandler.java:15)
[12/14/2019 3:14:12 PM] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[12/14/2019 3:14:12 PM] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[12/14/2019 3:14:12 PM] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[12/14/2019 3:14:12 PM] at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
[12/14/2019 3:14:12 PM] at java.lang.Class.newInstance(Class.java:442)
[12/14/2019 3:14:12 PM] at com.microsoft.azure.functions.worker.broker.JavaMethodExecutor.lambda$execute$1(JavaMethodExecutor.java:54)
[12/14/2019 3:14:12 PM] at com.microsoft.azure.functions.worker.broker.JavaMethodInvokeInfo.invoke(JavaMethodInvokeInfo.java:20)
[12/14/2019 3:14:12 PM] at com.microsoft.azure.functions.worker.broker.JavaMethodExecutor.execute(JavaMethodExecutor.java:54)
[12/14/2019 3:14:12 PM] at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:53)
[12/14/2019 3:14:12 PM] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:33)
[12/14/2019 3:14:12 PM] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10)
[12/14/2019 3:14:12 PM] at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
[12/14/2019 3:14:12 PM] at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92)
[12/14/2019 3:14:12 PM] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[12/14/2019 3:14:12 PM] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[12/14/2019 3:14:12 PM] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[12/14/2019 3:14:12 PM] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[12/14/2019 3:14:12 PM] at java.lang.Thread.run(Thread.java:748)
[12/14/2019 3:14:12 PM] Caused by: java.lang.IllegalArgumentException: Failed to locate main class

Expected/desired behavior

I should be able to call the function without any problem

OS and Version?

Ubuntu 19

Versions

java version 8.0.222.hs-adpt
azure-functions-core-tools@3
maven version 3.6.2

No dependency injection example availability

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Not able to find now Hello component used in the function.

@Component
public class Hello implements Function<Mono<User>, Mono<Greeting>> {
public Mono<Greeting> apply(Mono<User> mono) {
return mono.map(user -> new Greeting("Hello, " + user.getName() + "!\n"));
}
}

Can we use same object across multiple https triggers?

Project run doesn't works

I'm trying to run the project (maven version).
mvn package it's ok but when I try to run locally the command give me that:
C:\git_cloud\hello-spring-function-azure-master>mvnw.cmd azure-functions:run
Found "C:\git_cloud\hello-spring-function-azure-master.mvn\wrapper\maven-wrapper.jar"
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< com.example:hello >--------------------------
[INFO] Building Hello Spring Function on Azure 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- azure-functions-maven-plugin:1.9.0:run (default-cli) @ hello ---
[WARNING] The POM for com.microsoft.azure.applicationinsights.v2015_05_01:azure-mgmt-insights:jar:1.0.0-beta is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] Azure Function App's staging directory found at: C:\git_cloud\hello-spring-function-azure-master\target\azure-functions\innovationfun

Minimal steps to reproduce

  • git clone
  • config appname and resource name
  • mvnw clean test
  • mvnw package
  • mvnw azure-function:un

System.Private.CoreLib: Exception while executing function: Functions.hello. System.Private.CoreLib: Result: Failure Exception: NoSuchElementException: No value present Stack: java.lang.reflect.InvocationTargetException

I am getting below exception when I execute this example

Azure Functions Core Tools (3.0.2630 Commit hash: beec61496e1c5de8aa4ba38d1884f7b48233a7ab)
Function Runtime Version: 3.0.13901.0

[10/5/2020 7:42:24 PM] Executing HTTP request: {
[10/5/2020 7:42:24 PM] "requestId": "a5ca11b1-b512-4516-8f92-2eefbc63d164",
[10/5/2020 7:42:24 PM] "method": "GET",
[10/5/2020 7:42:24 PM] "uri": "/api/hello"
[10/5/2020 7:42:24 PM] }
[10/5/2020 7:42:24 PM] Executing 'Functions.hello' (Reason='This function was programmatically called via the host APIs.', Id=9fc63423-3bdd-4ce1-ae48-c58d97827064)
[10/5/2020 7:42:24 PM] 15:42:24.545 [pool-2-thread-1] INFO org.springframework.cloud.function.utils.FunctionClassUtils - Main class: class com.example.HelloFunction
[10/5/2020 7:42:24 PM] Executed 'Functions.hello' (Failed, Id=9fc63423-3bdd-4ce1-ae48-c58d97827064)
[10/5/2020 7:42:24 PM] System.Private.CoreLib: Exception while executing function: Functions.hello. System.Private.CoreLib: Result: Failure
Exception: NoSuchElementException: No value present
Stack: java.lang.reflect.InvocationTargetException
[10/5/2020 7:42:24 PM] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[10/5/2020 7:42:24 PM] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[10/5/2020 7:42:24 PM] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[10/5/2020 7:42:24 PM] at java.lang.reflect.Method.invoke(Method.java:498)
[10/5/2020 7:42:24 PM] at com.microsoft.azure.functions.worker.broker.JavaMethodInvokeInfo.invoke(JavaMethodInvokeInfo.java:22)
[10/5/2020 7:42:24 PM] at com.microsoft.azure.functions.worker.broker.JavaMethodExecutorImpl.execute(JavaMethodExecutorImpl.java:54)
[10/5/2020 7:42:24 PM] at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:53)
[10/5/2020 7:42:24 PM] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:33)
[10/5/2020 7:42:24 PM] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10)
[10/5/2020 7:42:24 PM] at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
[10/5/2020 7:42:24 PM] at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92)
[10/5/2020 7:42:24 PM] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[10/5/2020 7:42:24 PM] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[10/5/2020 7:42:24 PM] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[10/5/2020 7:42:24 PM] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[10/5/2020 7:42:24 PM] at java.lang.Thread.run(Thread.java:748)
[10/5/2020 7:42:24 PM] Caused by: java.util.NoSuchElementException: No value present
[10/5/2020 7:42:24 PM] at java.util.Optional.get(Optional.java:135)
[10/5/2020 7:42:24 PM] at com.example.HelloHandler.execute(HelloHandler.java:20)
[10/5/2020 7:42:24 PM] ... 16 more
[10/5/2020 7:42:24 PM] .
[10/5/2020 7:42:24 PM] Executed HTTP request: {
[10/5/2020 7:42:24 PM] "requestId": "a5ca11b1-b512-4516-8f92-2eefbc63d164",
[10/5/2020 7:42:24 PM] "method": "GET",
[10/5/2020 7:42:24 PM] "uri": "/api/hello",
[10/5/2020 7:42:24 PM] "identities": [
[10/5/2020 7:42:24 PM] {
[10/5/2020 7:42:24 PM] "type": "WebJobsAuthLevel",
[10/5/2020 7:42:24 PM] "level": "Admin"
[10/5/2020 7:42:24 PM] }
[10/5/2020 7:42:24 PM] ],
[10/5/2020 7:42:24 PM] "status": 500,
[10/5/2020 7:42:24 PM] "duration": 276
[10/5/2020 7:42:24 PM] }

No available subscription found in current account

Hi,
I followed this tutorial step by step.
Package goal was OK.
Run goal was OK.
But I encountered a problem during the deploy, I received the following error:
No available subscription found in current account

The only way to solve it was to solve it was by following this documentation:
https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/error-register-resource-provider

and to add a registration
az provider register --namespace 'microsoft.insights'
Where to find that stuff in the readme or in a documentation?

Spring Filters aren't working

Spring Filters aren't working:

We have built an Azure Function using Azure Spring Boot starter kit. We have a use case wherein we have validate a token in the request header of the incoming request.

We were thinking of implementing a Filter for this. However, the filter is not getting invoked even though we have registered it in the filter chain

Web security configuration:

package com.xxx;

import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter;

@EnableWebSecurity(debug = true) // when you want to see what filters are applied
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

  @Override
  public void configure(HttpSecurity http) throws Exception {
    http.addFilterBefore(new AuthenticationFilter(), WebAsyncManagerIntegrationFilter.class);
  }
}

Authentication Filter:

package com.xxx;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.filter.GenericFilterBean;


@WebFilter(urlPatterns = "/api/*")
public class AuthenticationFilter extends GenericFilterBean {

     @Override
     public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {

      HttpServletRequest request = (HttpServletRequest) servletRequest;
      HttpServletResponse response = (HttpServletResponse) servletResponse;

      System.out.println("This Filter is only called when request is mapped for /customer resource");

      //call next filter in the filter chain
      filterChain.doFilter(request, response);
     }

     @Override
     public void destroy() {

     }

}

Please provide some pointers?

I can't run project

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report 

Minimal steps to reproduce

git clone https://github.com/Azure-Samples/hello-spring-function-azure.git
./mvnw clean package
./mvnw azure-functions:run

Any log messages given by the failure

[12/2/2019 6:56:59 PM] Executing 'Functions.hello' (Reason='This function was programmatically called via the host APIs.', Id=26b096d4-ba06-440b-9e15-2d9d841ebc7f)
[12/2/2019 6:56:59 PM] 13:56:59.580 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifests: [jar:file:/C:/Users/mcontreras/AppData/Roaming/npm/node_modules/azure-functions-core-tools/bin/workers/java/azure-functions-java-worker.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/hello-1.0-SNAPSHOT.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/azure-functions-java-library-1.2.2.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/jackson-annotations-2.10.0.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/jackson-core-2.10.0.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/jackson-databind-2.10.0.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/jakarta.annotation-api-1.3.5.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/jul-to-slf4j-1.7.29.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/log4j-api-2.12.1.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/log4j-to-slf4j-2.12.1.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/logback-classic-1.2.3.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/logback-core-1.2.3.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/reactive-streams-1.0.3.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/reactor-core-3.3.0.RELEASE.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/slf4j-api-1.7.29.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/snakeyaml-1.25.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-aop-5.2.1.RELEASE.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-beans-5.2.1.RELEASE.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-boot-2.2.1.RELEASE.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-boot-autoconfigure-2.2.1.RELEASE.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-boot-starter-2.2.1.RELEASE.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-boot-starter-logging-2.2.1.RELEASE.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-cloud-function-adapter-azure-3.0.0.RELEASE.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-cloud-function-context-3.0.0.RELEASE.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-cloud-function-core-3.0.0.RELEASE.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-context-5.2.1.RELEASE.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-core-5.2.1.RELEASE.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-expression-5.2.1.RELEASE.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-jcl-5.2.1.RELEASE.jar!/META-INF/MANIFEST.MF, jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-messaging-5.2.1.RELEASE.jar!/META-INF/MANIFEST.MF]
[12/2/2019 6:56:59 PM] 13:56:59.580 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/Users/mcontreras/AppData/Roaming/npm/node_modules/azure-functions-core-tools/bin/workers/java/azure-functions-java-worker.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] 13:56:59.581 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/hello-1.0-SNAPSHOT.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] 13:56:59.582 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/azure-functions-java-library-1.2.2.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] 13:56:59.584 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/jackson-annotations-2.10.0.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] 13:56:59.585 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/jackson-core-2.10.0.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] Executed 'Functions.hello' (Failed, Id=26b096d4-ba06-440b-9e15-2d9d841ebc7f)
[12/2/2019 6:56:59 PM] System.Private.CoreLib: Exception while executing function: Functions.hello. System.Private.CoreLib: Result: Failure
Exception: IllegalArgumentException: Failed to locate main class
Stack: 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).
[12/2/2019 6:56:59 PM] 13:56:59.586 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/jackson-databind-2.10.0.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.getStartClass(AbstractSpringFunctionAdapterInitializer.java:288)
[12/2/2019 6:56:59 PM] 13:56:59.588 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/jakarta.annotation-api-1.3.5.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.(AbstractSpringFunctionAdapterInitializer.java:100)
[12/2/2019 6:56:59 PM] 13:56:59.589 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/jul-to-slf4j-1.7.29.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at org.springframework.cloud.function.adapter.azure.AzureSpringBootRequestHandler.(AzureSpringBootRequestHandler.java:44)
[12/2/2019 6:56:59 PM] 13:56:59.590 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/log4j-api-2.12.1.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at com.example.HelloHandler.(HelloHandler.java:15)
[12/2/2019 6:56:59 PM] 13:56:59.590 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/log4j-to-slf4j-2.12.1.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[12/2/2019 6:56:59 PM] 13:56:59.591 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/logback-classic-1.2.3.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[12/2/2019 6:56:59 PM] 13:56:59.591 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/logback-core-1.2.3.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[12/2/2019 6:56:59 PM] 13:56:59.591 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/reactive-streams-1.0.3.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
[12/2/2019 6:56:59 PM] 13:56:59.592 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/reactor-core-3.3.0.RELEASE.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at java.lang.Class.newInstance(Class.java:442)
[12/2/2019 6:56:59 PM] 13:56:59.592 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/slf4j-api-1.7.29.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at com.microsoft.azure.functions.worker.broker.JavaMethodExecutor.lambda$execute$1(JavaMethodExecutor.java:54)
[12/2/2019 6:56:59 PM] at com.microsoft.azure.functions.worker.broker.JavaMethodInvokeInfo.invoke(JavaMethodInvokeInfo.java:20)
[12/2/2019 6:56:59 PM] 13:56:59.592 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/snakeyaml-1.25.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at com.microsoft.azure.functions.worker.broker.JavaMethodExecutor.execute(JavaMethodExecutor.java:54)
[12/2/2019 6:56:59 PM] 13:56:59.592 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-aop-5.2.1.RELEASE.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:53)
[12/2/2019 6:56:59 PM] 13:56:59.593 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-beans-5.2.1.RELEASE.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:33)
[12/2/2019 6:56:59 PM] 13:56:59.593 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-boot-2.2.1.RELEASE.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10)
[12/2/2019 6:56:59 PM] 13:56:59.593 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-boot-autoconfigure-2.2.1.RELEASE.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
[12/2/2019 6:56:59 PM] 13:56:59.594 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-boot-starter-2.2.1.RELEASE.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92)
[12/2/2019 6:56:59 PM] 13:56:59.594 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-boot-starter-logging-2.2.1.RELEASE.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[12/2/2019 6:56:59 PM] 13:56:59.594 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-cloud-function-adapter-azure-3.0.0.RELEASE.[12/2/2019 6:56:59 PM] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[12/2/2019 6:56:59 PM] 13:56:59.595 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching man
ifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-cloud-function-context-3.0.0.RELEASE.jar!/M
ETA-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[12/2/2019 6:56:59 PM] 13:56:59.595 [pool-2-thread-2
] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching manifest: jar:file:/C:/dev/git-repos/hello-spring-funct
ion-azure/target/azure-functions/my-spring-function/lib/spring-cloud-function-core-3.0.0.RELEASE.jar!/META-INF/MANIFEST.MF

[12/2/2019 6:56:59 PM] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[12/2/2019 6:56:59 PM] at java.lang.Thread.run(Thread.java:748)
[12/2/2019 6:56:59 PM] Caused by: java.lang.IllegalArgumentException: Failed to locate main class
[12/2/2019 6:56:59 PM] 13:56:59.596 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching man
ifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-context-5.2.1.RELEASE.jar!/META-INF/MANIFES
T.MF
[12/2/2019 6:56:59 PM] at org.springframework.util.Assert.notNull(Assert.java:198)
[12/2/2019 6:56:59 PM] 13:56:59.596 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching man
ifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-core-5.2.1.RELEASE.jar!/META-INF/MANIFEST.M
F
[12/2/2019 6:56:59 PM] at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.getStartClass(AbstractSpringFunctionAdapterInit
ializer.java:284)
[12/2/2019 6:56:59 PM] 13:56:59.596 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching man
ifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-expression-5.2.1.RELEASE.jar!/META-INF/MANI
FEST.MF
[12/2/2019 6:56:59 PM] ... 21 more
[12/2/2019 6:56:59 PM] 13:56:59.597 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching man
ifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-jcl-5.2.1.RELEASE.jar!/META-INF/MANIFEST.MF
[12/2/2019 6:56:59 PM] .
[12/2/2019 6:56:59 PM] 13:56:59.597 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching man
ifest: jar:file:/C:/dev/git-repos/hello-spring-function-azure/target/azure-functions/my-spring-function/lib/spring-messaging-5.2.1.RELEASE.jar!/META-INF/MANIF
EST.MF
[12/2/2019 6:56:59 PM] 13:56:59.598 [pool-2-thread-2] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Searching man
ifests: []
[12/2/2019 6:56:59 PM] Executed HTTP request: {
[12/2/2019 6:56:59 PM] "requestId": "9ad570ee-ec9e-4ff5-9a9e-9cdef4b2bed5",
[12/2/2019 6:56:59 PM] "method": "GET",
[12/2/2019 6:56:59 PM] "uri": "/api/hello",
[12/2/2019 6:56:59 PM] "identities": [
[12/2/2019 6:56:59 PM] {
[12/2/2019 6:56:59 PM] "type": "WebJobsAuthLevel",
[12/2/2019 6:56:59 PM] "level": "Admin"
[12/2/2019 6:56:59 PM] }
[12/2/2019 6:56:59 PM] ],
[12/2/2019 6:56:59 PM] "status": 500,
[12/2/2019 6:56:59 PM] "duration": 11242
[12/2/2019 6:56:59 PM] }

OS and Version?

Windows 10.

Versions

Mention any other details that might be useful

I could make it work by returning



org.springframework.cloud
spring-cloud-function-dependencies
2.0.1.RELEASE
pom
import


Thanks! We'll be in touch soon.

Java azure function OS recommendation Linux vs Windows

This issue is for the particular commit message in this repo.

Java 11 is the latest LTS so it expected to perform better as it has several improvements over Java 8.
Can we say also Java azure functions perform better on Linux in comparison to Windows? that's the reason overall Linux + Java11 is the best combination for Java Azure functions.

This is a question, not a bug.

Errror: i have made little change in this application, have added JPA and Entity,locally it works fine ,while deploying in azure as function while hitting the post request it throws below error,

2020-08-02T17:42:57.544 [Information] on-parent/spring-cloud-function-web
2020-08-02T17:42:57.544 [Information] 17:42:56.673 [pool-2-thread-4] INFO org.springframework.cloud.function.utils.FunctionClassUtils - Loaded Start Class: class org.springframework.cloud.function.web.RestApplication
2020-08-02T17:42:57.544 [Information] 17:42:56.673 [pool-2-thread-4] INFO org.springframework.cloud.function.utils.FunctionClassUtils - Main class: class org.springframework.cloud.function.web.RestApplication
2020-08-02T17:42:57.545 [Information] 17:42:56.692 [pool-2-thread-4] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Initializing: class org.springframework.cloud.function.web.RestApplication
2020-08-02T17:43:00.026 [Information] . ____ _ __ _ _
2020-08-02T17:43:00.026 [Information] /\ / ' __ _ () __ __ _ \ \ \
2020-08-02T17:43:00.026 [Information] ( ( )_
_ | '_ | '| | ' / ` | \ \ \
2020-08-02T17:43:00.027 [Information] \/ )| |)| | | | | || (| | ) ) ) )
2020-08-02T17:43:00.027 [Information] ' |
| .__|| ||| |_, | / / / /
2020-08-02T17:43:00.027 [Information] =========|
|==============|/=////
2020-08-02T17:43:00.500 [Information] :: Spring Boot :: (v2.2.7.RELEASE)
2020-08-02T17:43:00.501 [Information] 2020-08-02 17:43:00.439 INFO 5372 --- [pool-2-thread-4] o.s.boot.SpringApplication : Starting application on RD2818786E8DDF with PID 5372 (D:\home\site\wwwroot\lib\spring-cloud-function-web-3.0.6.RELEASE.jar started by RD2818786E8DDF$ in D:\local\Temp\functions\standby\wwwroot)
2020-08-02T17:43:00.501 [Information] 2020-08-02 17:43:00.470 INFO 5372 --- [pool-2-thread-4] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2020-08-02T17:43:03.651 [Information] 2020-08-02 17:43:03.236 INFO 5372 --- [pool-2-thread-4] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2020-08-02T17:43:03.651 [Information] 2020-08-02 17:43:03.492 INFO 5372 --- [pool-2-thread-4] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 219ms. Found 0 JPA repository interfaces.
2020-08-02T17:43:05.789 [Information] 2020-08-02 17:43:05.631 WARN 5372 --- [pool-2-thread-4] o.s.c.support.GenericApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Unable to resolve persistence unit root URL
2020-08-02T17:43:05.789 [Information] 2020-08-02 17:43:05.690 INFO 5372 --- [pool-2-thread-4] ConditionEvaluationReportLoggingListener :
2020-08-02T17:43:05.789 [Information] Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-08-02T17:43:05.803 [Information] 2020-08-02 17:43:05.783 ERROR 5372 --- [pool-2-thread-4] o.s.boot.SpringApplication : Application run failed
2020-08-02T17:43:05.811 [Information] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Unable to resolve persistence unit root URL
2020-08-02T17:43:05.811 [Information] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.811 [Information] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.859 [Information] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.860 [Information] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.860 [Information] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.860 [Information] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.860 [Information] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.861 [Information] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1108) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.861 [Information] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.861 [Information] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.861 [Information] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.7.RELEASE.jar:2.2.7.RELEASE]
2020-08-02T17:43:05.861 [Information] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.7.RELEASE.jar:2.2.7.RELEASE]
2020-08-02T17:43:05.861 [Information] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.7.RELEASE.jar:2.2.7.RELEASE]
2020-08-02T17:43:05.861 [Information] at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.initialize(AbstractSpringFunctionAdapterInitializer.java:117) [spring-cloud-function-context-3.0.6.RELEASE.jar:3.0.6.RELEASE]
2020-08-02T17:43:05.861 [Information] at org.springframework.cloud.function.adapter.azure.AzureSpringBootRequestHandler.handleRequest(AzureSpringBootRequestHandler.java:80) [spring-cloud-function-adapter-azure-3.0.6.RELEASE.jar:3.0.6.RELEASE]
2020-08-02T17:43:05.861 [Information] at com.example.HelloHandler.saveEmployee(HelloHandler.java:49) [hello-spring-function-azure.jar:na]
2020-08-02T17:43:05.862 [Information] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_232]
2020-08-02T17:43:05.862 [Information] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_232]
2020-08-02T17:43:05.867 [Information] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_232]
2020-08-02T17:43:05.868 [Information] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_232]
2020-08-02T17:43:05.868 [Information] at com.microsoft.azure.functions.worker.broker.JavaMethodInvokeInfo.invoke(JavaMethodInvokeInfo.java:22) [azure-functions-java-worker.jar:1.5.3]
2020-08-02T17:43:05.868 [Information] at com.microsoft.azure.functions.worker.broker.JavaMethodExecutorImpl.execute(JavaMethodExecutorImpl.java:54) [azure-functions-java-worker.jar:1.5.3]
2020-08-02T17:43:05.868 [Information] at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:52) [azure-functions-java-worker.jar:1.5.3]
2020-08-02T17:43:05.868 [Information] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:33) [azure-functions-java-worker.jar:1.5.3]
2020-08-02T17:43:05.868 [Information] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10) [azure-functions-java-worker.jar:1.5.3]
2020-08-02T17:43:05.868 [Information] at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45) [azure-functions-java-worker.jar:1.5.3]
2020-08-02T17:43:05.868 [Information] at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92) [azure-functions-java-worker.jar:1.5.3]
2020-08-02T17:43:05.868 [Information] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_232]
2020-08-02T17:43:05.868 [Information] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_232]
2020-08-02T17:43:05.868 [Information] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_232]
2020-08-02T17:43:05.869 [Information] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_232]
2020-08-02T17:43:05.869 [Information] at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_232]
2020-08-02T17:43:05.869 [Information] Caused by: javax.persistence.PersistenceException: Unable to resolve persistence unit root URL
2020-08-02T17:43:05.869 [Information] at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.determineDefaultPersistenceUnitRootUrl(DefaultPersistenceUnitManager.java:641) ~[spring-orm-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.869 [Information] at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.preparePersistenceUnitInfos(DefaultPersistenceUnitManager.java:463) ~[spring-orm-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.869 [Information] at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.afterPropertiesSet(DefaultPersistenceUnitManager.java:444) ~[spring-orm-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.869 [Information] at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:328) ~[spring-orm-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.869 [Information] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.869 [Information] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.869 [Information] ... 31 common frames omitted
2020-08-02T17:43:05.869 [Information] Caused by: java.io.FileNotFoundException: class path resource [] cannot be resolved to URL because it does not exist
2020-08-02T17:43:05.870 [Information] at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:195) ~[spring-core-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.870 [Information] at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.determineDefaultPersistenceUnitRootUrl(DefaultPersistenceUnitManager.java:637) ~[spring-orm-5.2.6.RELEASE.jar:5.2.6.RELEASE]
2020-08-02T17:43:05.870 [Information] ... 36 common frames omitted
2020-08-02T17:43:05.986 [Error] Executed 'Functions.saveEmployee' (Failed, Id=87a963a8-df30-4360-ba37-53e906c4bb6b, Duration=12924ms)
Result: Failure
Exception: FileNotFoundException: class path resource [] cannot be resolved to URL because it does not exist
Stack: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.microsoft.azure.functions.worker.broker.JavaMethodInvokeInfo.invoke(JavaMethodInvokeInfo.java:22)
at com.microsoft.azure.functions.worker.broker.JavaMethodExecutorImpl.execute(JavaMethodExecutorImpl.java:54)
at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:52)
at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:33)
at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10)
at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Unable to resolve persistence unit root URL
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1108)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.initialize(AbstractSpringFunctionAdapterInitializer.java:117)
at org.springframework.cloud.function.adapter.azure.AzureSpringBootRequestHandler.handleRequest(AzureSpringBootRequestHandler.java:80)
at com.example.HelloHandler.saveEmployee(HelloHandler.java:49)
... 16 more
Caused by: javax.persistence.PersistenceException: Unable to resolve persistence unit root URL
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.determineDefaultPersistenceUnitRootUrl(DefaultPersistenceUnitManager.java:641)
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.preparePersistenceUnitInfos(DefaultPersistenceUnitManager.java:463)
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.afterPropertiesSet(DefaultPersistenceUnitManager.java:444)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:328)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)
... 31 more
Caused by: java.io.FileNotFoundException: class path resource [] cannot be resolved to URL because it does not exist
at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:195)
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.determineDefaultPersistenceUnitRootUrl(DefaultPersistenceUnitManager.java:637)
... 36 more
2020-08-02T17:43:06.035 [Error] Executed 'Functions.saveEmployee' (Failed, Id=87a963a8-df30-4360-ba37-53e906c4bb6b, Duration=12924ms)
Result: Failure
Exception: FileNotFoundException: class path resource [] cannot be resolved to URL because it does not exist
Stack: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.microsoft.azure.functions.worker.broker.JavaMethodInvokeInfo.invoke(JavaMethodInvokeInfo.java:22)
at com.microsoft.azure.functions.worker.broker.JavaMethodExecutorImpl.execute(JavaMethodExecutorImpl.java:54)
at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:52)
at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:33)
at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10)
at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Unable to resolve persistence unit root URL
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1108)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.initialize(AbstractSpringFunctionAdapterInitializer.java:117)
at org.springframework.cloud.function.adapter.azure.AzureSpringBootRequestHandler.handleRequest(AzureSpringBootRequestHandler.java:80)
at com.example.HelloHandler.saveEmployee(HelloHandler.java:49)
... 16 more
Caused by: javax.persistence.PersistenceException: Unable to resolve persistence unit root URL
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.determineDefaultPersistenceUnitRootUrl(DefaultPersistenceUnitManager.java:641)
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.preparePersistenceUnitInfos(DefaultPersistenceUnitManager.java:463)
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.afterPropertiesSet(DefaultPersistenceUnitManager.java:444)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:328)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)
... 31 more
Caused by: java.io.FileNotFoundException: class path resource [] cannot be resolved to URL because it does not exist
at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:195)
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.determineDefaultPersistenceUnitRootUrl(DefaultPersistenceUnitManager.java:637)
... 36 more

=======================================================
where i am wrong i don't know ,full git code is attached here

https://github.com/mitesh293/AzureSpringDataJpa

RpcException when having parallel requests

This issue is for a: (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

  • Deploy spring function sample app to Azure Function (Consumption Plan)
  • Simulate peak with 180 parallel users sending GET requests to "hello" function (e.g. with JMeter)
  • Wait for getting HTTP 500 Exceptions

Any log messages given by the failure

Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException:


Exception while executing function: Functions.hello Result: Failure
Exception: NoSuchElementException: 
Stack: java.lang.reflect.InvocationTargetException
	at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at com.microsoft.azure.functions.worker.broker.JavaMethodInvokeInfo.invoke(JavaMethodInvokeInfo.java:22)
	at com.microsoft.azure.functions.worker.broker.EnhancedJavaMethodExecutorImpl.execute(EnhancedJavaMethodExecutorImpl.java:55)
	at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:57)
	at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:33)
	at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10)
	at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
	at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: java.util.NoSuchElementException
	at org.springframework.cloud.function.adapter.azure.AzureSpringBootRequestHandler.handleRequest(AzureSpringBootRequestHandler.java:101)
	at com.example.HelloHandler.execute(HelloHandler.java:28)
	... 15 more
Caused by: java.lang.IllegalStateException: java.util.NoSuchElementException
	at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:327)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:281)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:239)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:216)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
	at java.base/java.util.ArrayList.forEach(Unknown Source)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62)
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
	at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.initialize(AbstractSpringFunctionAdapterInitializer.java:118)
	at org.springframework.cloud.function.adapter.azure.AzureSpringBootRequestHandler.handleRequest(AzureSpringBootRequestHandler.java:82)
	... 16 more
Caused by: java.util.NoSuchElementException
	at java.base/java.util.ArrayList$Itr.next(Unknown Source)
	at ch.qos.logback.classic.LoggerContext.fireOnReset(LoggerContext.java:323)
	at ch.qos.logback.classic.LoggerContext.reset(LoggerContext.java:226)
	at ch.qos.logback.classic.LoggerContext.stop(LoggerContext.java:348)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.stopAndReset(LogbackLoggingSystem.java:196)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadDefaults(LogbackLoggingSystem.java:144)
	at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:83)
	at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:132)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:312)
	... 33 more

Expected/desired behavior

Azure function on consumption plan can scale out seamlessly (without exceptions) as parallel requests increase.

Configuration Function App

FUNCTIONS_EXTENSION_VERSION: ~3
FUNCTIONS_WORKER_RUNTIME: java

EventHubTrigger not working with Spring Cloud

I have been working on Integrating EventHubTrigger azure function with Spring cloud for the past one week. I have tried all the possible options and it keeps throwing

Exception: IllegalStateException: No function defined
Stack: java.lang.reflect.InvocationTargetException

This is very urgent requirement that I am working on. Do you support only HttpTrigger at this point ? Please direct me to the right to check about the EventHubTrigger.

Unable to run test locally

This issue is for a: (mark with an x)

- [ x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

$ ./mvnw clean test package azure-functions:run
$ curl http://localhost:7071/api/hello -d "{\"name\":\"Azure\"}"

Any log messages given by the failure

./mvnw clean test package azure-functions:run
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< com.example:hello >--------------------------
[INFO] Building Hello Spring Function on Azure 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ hello ---
[INFO] Deleting /Users/pomverte/git/hello-spring-function-azure/target
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ hello ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/pomverte/git/hello-spring-function-azure/src/main/resources
[INFO] skip non existing resourceDirectory /Users/pomverte/git/hello-spring-function-azure/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ hello ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /Users/pomverte/git/hello-spring-function-azure/target/classes
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ hello ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/pomverte/git/hello-spring-function-azure/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ hello ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/pomverte/git/hello-spring-function-azure/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ hello ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.example.HelloFunctionTest
14:52:11.305 [main] INFO org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer - Initializing: class com.example.HelloFunction

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.7.RELEASE)

2020-05-16 14:52:11.602  INFO 37140 --- [           main] o.a.maven.surefire.booter.ForkedBooter   : Starting ForkedBooter v2.22.2 on AMAC02X61ECJG5M with PID 37140 (started by pomverte in /Users/pomverte/git/hello-spring-function-azure)
2020-05-16 14:52:11.604  INFO 37140 --- [           main] o.a.maven.surefire.booter.ForkedBooter   : No active profile set, falling back to default profiles: default
2020-05-16 14:52:12.116  INFO 37140 --- [           main] o.a.maven.surefire.booter.ForkedBooter   : Started ForkedBooter in 0.741 seconds (JVM running for 1.405)
2020-05-16 14:52:12.120  INFO 37140 --- [           main] c.f.c.c.BeanFactoryAwareFunctionRegistry : Looking up function 'function' with acceptedOutputTypes: []
2020-05-16 14:52:12.121  WARN 37140 --- [           main] c.f.c.c.BeanFactoryAwareFunctionRegistry : !!! Failed to discover function 'function' in function catalog. Function available in catalog are: [hello, functionRouter]
2020-05-16 14:52:12.121  INFO 37140 --- [           main] c.f.c.c.BeanFactoryAwareFunctionRegistry : Looking up function 'consumer' with acceptedOutputTypes: []
2020-05-16 14:52:12.121  WARN 37140 --- [           main] c.f.c.c.BeanFactoryAwareFunctionRegistry : !!! Failed to discover function 'consumer' in function catalog. Function available in catalog are: [hello, functionRouter]
2020-05-16 14:52:12.121  INFO 37140 --- [           main] c.f.c.c.BeanFactoryAwareFunctionRegistry : Looking up function 'supplier' with acceptedOutputTypes: []
2020-05-16 14:52:12.121  WARN 37140 --- [           main] c.f.c.c.BeanFactoryAwareFunctionRegistry : !!! Failed to discover function 'supplier' in function catalog. Function available in catalog are: [hello, functionRouter]
2020-05-16 14:52:12.122  INFO 37140 --- [           main] c.f.c.c.BeanFactoryAwareFunctionRegistry : Looking up function 'hello' with acceptedOutputTypes: []
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.049 s - in com.example.HelloFunctionTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ hello ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/pomverte/git/hello-spring-function-azure/src/main/resources
[INFO] skip non existing resourceDirectory /Users/pomverte/git/hello-spring-function-azure/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ hello ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /Users/pomverte/git/hello-spring-function-azure/target/classes
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ hello ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/pomverte/git/hello-spring-function-azure/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ hello ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/pomverte/git/hello-spring-function-azure/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ hello ---
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] --- maven-dependency-plugin:3.1.2:copy-dependencies (copy-dependencies) @ hello ---
[INFO] Copying spring-cloud-function-adapter-azure-3.0.6.RELEASE.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/spring-cloud-function-adapter-azure-3.0.6.RELEASE.jar
[INFO] Copying spring-cloud-function-context-3.0.6.RELEASE.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/spring-cloud-function-context-3.0.6.RELEASE.jar
[INFO] Copying typetools-0.6.2.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/typetools-0.6.2.jar
[INFO] Copying spring-boot-autoconfigure-2.2.7.RELEASE.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/spring-boot-autoconfigure-2.2.7.RELEASE.jar
[INFO] Copying spring-cloud-function-core-3.0.6.RELEASE.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/spring-cloud-function-core-3.0.6.RELEASE.jar
[INFO] Copying spring-messaging-5.2.6.RELEASE.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/spring-messaging-5.2.6.RELEASE.jar
[INFO] Copying spring-beans-5.2.6.RELEASE.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/spring-beans-5.2.6.RELEASE.jar
[INFO] Copying jackson-databind-2.10.4.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/jackson-databind-2.10.4.jar
[INFO] Copying jackson-annotations-2.10.4.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/jackson-annotations-2.10.4.jar
[INFO] Copying jackson-core-2.10.4.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/jackson-core-2.10.4.jar
[INFO] Copying spring-boot-starter-2.2.7.RELEASE.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/spring-boot-starter-2.2.7.RELEASE.jar
[INFO] Copying spring-boot-2.2.7.RELEASE.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/spring-boot-2.2.7.RELEASE.jar
[INFO] Copying spring-context-5.2.6.RELEASE.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/spring-context-5.2.6.RELEASE.jar
[INFO] Copying spring-boot-starter-logging-2.2.7.RELEASE.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/spring-boot-starter-logging-2.2.7.RELEASE.jar
[INFO] Copying logback-classic-1.2.3.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/logback-classic-1.2.3.jar
[INFO] Copying logback-core-1.2.3.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/logback-core-1.2.3.jar
[INFO] Copying log4j-to-slf4j-2.12.1.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/log4j-to-slf4j-2.12.1.jar
[INFO] Copying log4j-api-2.12.1.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/log4j-api-2.12.1.jar
[INFO] Copying jul-to-slf4j-1.7.30.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/jul-to-slf4j-1.7.30.jar
[INFO] Copying jakarta.annotation-api-1.3.5.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/jakarta.annotation-api-1.3.5.jar
[INFO] Copying snakeyaml-1.25.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/snakeyaml-1.25.jar
[INFO] Copying reactor-core-3.3.5.RELEASE.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/reactor-core-3.3.5.RELEASE.jar
[INFO] Copying reactive-streams-1.0.3.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/reactive-streams-1.0.3.jar
[INFO] Copying azure-functions-java-library-1.2.2.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/azure-functions-java-library-1.2.2.jar
[INFO] Copying javax.annotation-api-1.3.2.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/javax.annotation-api-1.3.2.jar
[INFO] Copying spring-aop-5.2.6.RELEASE.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/spring-aop-5.2.6.RELEASE.jar
[INFO] Copying spring-expression-5.2.6.RELEASE.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/spring-expression-5.2.6.RELEASE.jar
[INFO] Copying slf4j-api-1.7.30.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/slf4j-api-1.7.30.jar
[INFO] Copying spring-core-5.2.6.RELEASE.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/spring-core-5.2.6.RELEASE.jar
[INFO] Copying spring-jcl-5.2.6.RELEASE.jar to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/lib/spring-jcl-5.2.6.RELEASE.jar
[INFO]
[INFO] --- maven-jar-plugin:3.1.2:jar (default-jar) @ hello ---
[INFO] Building jar: /Users/pomverte/git/hello-spring-function-azure/target/hello-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- azure-functions-maven-plugin:1.4.1:package (package-functions) @ hello ---
[WARNING] Azure Functions only support JDK 8, which is lower than local JDK version 11.0.7.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.microsoft.applicationinsights.core.dependencies.xstream.core.util.Fields (file:/Users/pomverte/.m2/repository/com/microsoft/azure/applicationinsights-core/2.5.1/applicationinsights-core-2.5.1.jar) to field java.util.TreeMap.comparator
WARNING: Please consider reporting this to the maintainers of com.microsoft.applicationinsights.core.dependencies.xstream.core.util.Fields
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO]
[INFO] Step 1 of 7: Searching for Azure Functions entry points
[INFO] 1 Azure Functions entry point(s) found.
[INFO]
[INFO] Step 2 of 7: Generating Azure Functions configurations
[INFO] Generation done.
[INFO]
[INFO] Step 3 of 7: Validating generated configurations
[INFO] Validation done.
[INFO]
[INFO] Step 4 of 7: Saving host.json
[INFO] Successfully saved to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/host.json
[INFO]
[INFO] Step 5 of 7: Saving configurations to function.json
[INFO] Starting processing function: hello
[INFO] Successfully saved to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/hello/function.json
[INFO]
[INFO] Step 6 of 7: Copying JARs to staging directory/Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource to /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function
[INFO] Copied successfully.
[INFO] Step 7 of 7: Installing function extensions if needed
[INFO] Skip install Function extension for HTTP Trigger Functions
[INFO] Successfully built Azure Functions.
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:copy-resources (copy-resources) @ hello ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- spring-boot-maven-plugin:2.2.7.RELEASE:repackage (repackage) @ hello ---
[INFO] Replacing main artifact with repackaged archive
[INFO]
[INFO] --- azure-functions-maven-plugin:1.4.1:run (default-cli) @ hello ---
[WARNING] Azure Functions only support JDK 8, which is lower than local JDK version 11.0.7.
[INFO] Azure Function App's staging directory found at: /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function
[INFO] Azure Functions Core Tools found.

                  %%%%%%
                 %%%%%%
            @   %%%%%%    @
          @@   %%%%%%      @@
       @@@    %%%%%%%%%%%    @@@
     @@      %%%%%%%%%%        @@
       @@         %%%%       @@
         @@      %%%       @@
           @@    %%      @@
                %%
                %

Azure Functions Core Tools (3.0.2245 Commit hash: 1d094e2f3ef79b9a478a1621ea7ec3f93ac1910d)
Function Runtime Version: 3.0.13139.0
[16/05/2020 12:52:19] FUNCTIONS_WORKER_RUNTIME set to java. Skipping WorkerConfig for language:python
[16/05/2020 12:52:19] FUNCTIONS_WORKER_RUNTIME set to java. Skipping WorkerConfig for language:powershell
[16/05/2020 12:52:19] FUNCTIONS_WORKER_RUNTIME set to java. Skipping WorkerConfig for language:node
[16/05/2020 12:52:19] Starting worker process:/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java  -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -noverify -Djava.net.preferIPv4Stack=true -jar "/usr/local/Cellar/azure-functions-core-tools@3/3.0.2245/workers/java/azure-functions-java-worker.jar" --host 127.0.0.1 --port 57061 --workerId 5764b5c5-4fa6-489c-b653-13330c895eaf --requestId 29f5485f-5fbf-4364-b8e9-376a1812468e --grpcMaxMessageLength 134217728
[16/05/2020 12:52:19] /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java process with Id=37192 started
[16/05/2020 12:52:20] [INFO] {Application.main}: Azure Functions Java Worker  version [ 1.5.2-SNAPSHOT]
[16/05/2020 12:52:20] [INFO] {MessageHandler.handle}: Message generated by "StartStream.Builder"
[16/05/2020 12:52:20] Building host: startup suppressed: 'False', configuration suppressed: 'False', startup operation id: 'eaa707f1-4ce1-4fbc-9239-9e509425312c'
[16/05/2020 12:52:20] Reading host configuration file '/Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/host.json'
[16/05/2020 12:52:20] Host configuration file read:
[16/05/2020 12:52:20] {
[16/05/2020 12:52:20]   "version": "2.0",
[16/05/2020 12:52:20]   "functionTimeout": "00:10:00"
[16/05/2020 12:52:20] }
[16/05/2020 12:52:20] Reading functions metadata
[16/05/2020 12:52:20] 1 functions found
[16/05/2020 12:52:20] Initializing Warmup Extension.
[16/05/2020 12:52:21] FUNCTIONS_WORKER_RUNTIME set to java. Skipping WorkerConfig for language:python
[16/05/2020 12:52:21] FUNCTIONS_WORKER_RUNTIME set to java. Skipping WorkerConfig for language:powershell
[16/05/2020 12:52:21] FUNCTIONS_WORKER_RUNTIME set to java. Skipping WorkerConfig for language:node
[16/05/2020 12:52:21] Initializing Host. OperationId: 'eaa707f1-4ce1-4fbc-9239-9e509425312c'.
[16/05/2020 12:52:21] Host initialization: ConsecutiveErrors=0, StartupCount=1, OperationId=eaa707f1-4ce1-4fbc-9239-9e509425312c
[16/05/2020 12:52:21] LoggerFilterOptions
[16/05/2020 12:52:21] {
[16/05/2020 12:52:21]   "MinLevel": "None",
[16/05/2020 12:52:21]   "Rules": [
[16/05/2020 12:52:21]     {
[16/05/2020 12:52:21]       "ProviderName": null,
[16/05/2020 12:52:21]       "CategoryName": null,
[16/05/2020 12:52:21]       "LogLevel": null,
[16/05/2020 12:52:21]       "Filter": "<AddFilter>b__0"
[16/05/2020 12:52:21]     },
[16/05/2020 12:52:21]     {
[16/05/2020 12:52:21]       "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider",
[16/05/2020 12:52:21]       "CategoryName": null,
[16/05/2020 12:52:21]       "LogLevel": "None",
[16/05/2020 12:52:21]       "Filter": null
[16/05/2020 12:52:21]     },
[16/05/2020 12:52:21]     {
[16/05/2020 12:52:21]       "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider",
[16/05/2020 12:52:21]       "CategoryName": null,
[16/05/2020 12:52:21]       "LogLevel": null,
[16/05/2020 12:52:21]       "Filter": "<AddFilter>b__0"
[16/05/2020 12:52:21]     }
[16/05/2020 12:52:21]   ]
[16/05/2020 12:52:21] }
[16/05/2020 12:52:21] FunctionResultAggregatorOptions
[16/05/2020 12:52:21] {
[16/05/2020 12:52:21]   "BatchSize": 1000,
[16/05/2020 12:52:21]   "FlushTimeout": "00:00:30",
[16/05/2020 12:52:21]   "IsEnabled": true
[16/05/2020 12:52:21] }
[16/05/2020 12:52:21] SingletonOptions
[16/05/2020 12:52:21] {
[16/05/2020 12:52:21]   "LockPeriod": "00:00:15",
[16/05/2020 12:52:21]   "ListenerLockPeriod": "00:00:15",
[16/05/2020 12:52:21]   "LockAcquisitionTimeout": "10675199.02:48:05.4775807",
[16/05/2020 12:52:21]   "LockAcquisitionPollingInterval": "00:00:05",
[16/05/2020 12:52:21]   "ListenerLockRecoveryPollingInterval": "00:01:00"
[16/05/2020 12:52:21] }
[16/05/2020 12:52:21] HttpOptions
[16/05/2020 12:52:21] {
[16/05/2020 12:52:21]   "DynamicThrottlesEnabled": false,
[16/05/2020 12:52:21]   "MaxConcurrentRequests": -1,
[16/05/2020 12:52:21]   "MaxOutstandingRequests": -1,
[16/05/2020 12:52:21]   "RoutePrefix": "api"
[16/05/2020 12:52:21] }
[16/05/2020 12:52:21] Starting JobHost
[16/05/2020 12:52:21] Starting Host (HostId=amac02x61ecjg5m-722775187, InstanceId=542fe8ae-936d-4b42-9a20-c59067833016, Version=3.0.13139.0, ProcessId=37191, AppDomainId=1, InDebugMode=False, InDiagnosticMode=False, FunctionsExtensionVersion=(null))
[16/05/2020 12:52:21] Loading functions metadata
[16/05/2020 12:52:21] 1 functions loaded
[16/05/2020 12:52:21] Generating 1 job function(s)
[16/05/2020 12:52:21] [INFO] {DefaultClassLoaderProvider.addUrl}: Loading file URL: file:/Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function/hello-1.0-SNAPSHOT.jar
[16/05/2020 12:52:21] Worker failed to function id 3d8382a0-0746-4c93-af63-cd6ec12aa2f9.
[16/05/2020 12:52:21] Result: Failure
[16/05/2020 12:52:21] Exception: ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
[16/05/2020 12:52:21] Stack: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
[16/05/2020 12:52:21] 	at com.microsoft.azure.functions.worker.reflect.DefaultClassLoaderProvider.addUrlToSystemClassLoader(DefaultClassLoaderProvider.java:72)
[16/05/2020 12:52:21] 	at com.microsoft.azure.functions.worker.reflect.DefaultClassLoaderProvider.addUrl(DefaultClassLoaderProvider.java:62)
[16/05/2020 12:52:21] 	at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.addSearchPathsToClassLoader(JavaFunctionBroker.java:64)
[16/05/2020 12:52:21] 	at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.loadMethod(JavaFunctionBroker.java:33)
[16/05/2020 12:52:21] 	at com.microsoft.azure.functions.worker.handler.FunctionLoadRequestHandler.execute(FunctionLoadRequestHandler.java:27)
[16/05/2020 12:52:21] 	at com.microsoft.azure.functions.worker.handler.FunctionLoadRequestHandler.execute(FunctionLoadRequestHandler.java:9)
[16/05/2020 12:52:21] 	at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
[16/05/2020 12:52:21] 	at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92)
[16/05/2020 12:52:21] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[16/05/2020 12:52:21] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[16/05/2020 12:52:21] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[16/05/2020 12:52:21] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[16/05/2020 12:52:21] 	at java.base/java.lang.Thread.run(Thread.java:834)
[16/05/2020 12:52:21] .
[16/05/2020 12:52:21] Found the following functions:
[16/05/2020 12:52:21] Host.Functions.hello
[16/05/2020 12:52:21]
[16/05/2020 12:52:21] Initializing function HTTP routes
[16/05/2020 12:52:21] Mapped function route 'api/hello' [GET,POST] to 'hello'
[16/05/2020 12:52:21]
[16/05/2020 12:52:21] Host initialized (151ms)
[16/05/2020 12:52:21] Host started (159ms)
[16/05/2020 12:52:21] Job host started

Http Functions:

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

Hosting environment: Production
Content root path: /Users/pomverte/git/hello-spring-function-azure/target/azure-functions/hvle-spring-function
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
[16/05/2020 12:52:26] Host lock lease acquired by instance ID '000000000000000000000000B32B4E5F'.
$ curl -v http://localhost:7071/api/hello -d "{\"name\":\"Azure\"}"
*   Trying ::1...
* TCP_NODELAY set
* Connection failed
* connect to ::1 port 7071 failed: Connection refused
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 7071 (#0)
> POST /api/hello HTTP/1.1
> Host: localhost:7071
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Length: 16
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 16 out of 16 bytes
< HTTP/1.1 500 Internal Server Error
< Date: Sat, 16 May 2020 12:53:42 GMT
< Server: Kestrel
< Content-Length: 0
<
* Connection #0 to host localhost left intact
[16/05/2020 12:52:56] Executing HTTP request: {
[16/05/2020 12:52:56]   "requestId": "83837a81-1301-4919-b824-6012669f345b",
[16/05/2020 12:52:56]   "method": "POST",
[16/05/2020 12:52:56]   "uri": "/api/hello"
[16/05/2020 12:52:56] }
[16/05/2020 12:52:56] Executing 'Functions.hello' (Reason='This function was programmatically called via the host APIs.', Id=1d3e5579-d13a-41dc-b12d-c223915ec43f)
[16/05/2020 12:52:56] Executed 'Functions.hello' (Failed, Id=1d3e5579-d13a-41dc-b12d-c223915ec43f)
[16/05/2020 12:52:56] System.Private.CoreLib: Exception while executing function: Functions.hello. System.Private.CoreLib: Result: Failure
[16/05/2020 12:52:56] Exception: ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
[16/05/2020 12:52:56] Stack: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
[16/05/2020 12:52:56] 	at com.microsoft.azure.functions.worker.reflect.DefaultClassLoaderProvider.addUrlToSystemClassLoader(DefaultClassLoaderProvider.java:72)
[16/05/2020 12:52:56] 	at com.microsoft.azure.functions.worker.reflect.DefaultClassLoaderProvider.addUrl(DefaultClassLoaderProvider.java:62)
[16/05/2020 12:52:56] 	at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.addSearchPathsToClassLoader(JavaFunctionBroker.java:64)
[16/05/2020 12:52:56] 	at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.loadMethod(JavaFunctionBroker.java:33)
[16/05/2020 12:52:56] 	at com.microsoft.azure.functions.worker.handler.FunctionLoadRequestHandler.execute(FunctionLoadRequestHandler.java:27)
[16/05/2020 12:52:56] 	at com.microsoft.azure.functions.worker.handler.FunctionLoadRequestHandler.execute(FunctionLoadRequestHandler.java:9)
[16/05/2020 12:52:56] 	at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
[16/05/2020 12:52:56] 	at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92)
[16/05/2020 12:52:56] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[16/05/2020 12:52:56] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[16/05/2020 12:52:56] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[16/05/2020 12:52:56] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[16/05/2020 12:52:56] 	at java.base/java.lang.Thread.run(Thread.java:834)
[16/05/2020 12:52:56] .
[16/05/2020 12:52:56] Executed HTTP request: {
[16/05/2020 12:52:56]   "requestId": "83837a81-1301-4919-b824-6012669f345b",
[16/05/2020 12:52:56]   "method": "POST",
[16/05/2020 12:52:56]   "uri": "/api/hello",
[16/05/2020 12:52:56]   "identities": [
[16/05/2020 12:52:56]     {
[16/05/2020 12:52:56]       "type": "WebJobsAuthLevel",
[16/05/2020 12:52:56]       "level": "Admin"
[16/05/2020 12:52:56]     }
[16/05/2020 12:52:56]   ],
[16/05/2020 12:52:56]   "status": 500,
[16/05/2020 12:52:56]   "duration": 256
[16/05/2020 12:52:56] }

Expected/desired behavior

To receive a response with Greeting user name: Azure

OS and Version?

macOS Mojave 10.14.6 (18G4032)

Versions

$ java -version
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.7+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.7+10, mixed mode)

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Issue with 2.1.1 spring-cloud-function-dependencies

Hi,
do you plan to upgrade spring-cloud-function-dependencies version in this sample project? I got Failed to locate main class exception for 2.1.1 spring-cloud-function-dependencies.

Stack: 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).
[26.11.2019 15:35:50] at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.getStartClass(AbstractSpringFunctionAdapterInitializer.java:283)
[26.11.2019 15:35:50] at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.(AbstractSpringFunctionAdapterInitializer.java:99)
[26.11.2019 15:35:50] at org.springframework.cloud.function.adapter.azure.AzureSpringBootRequestHandler.(AzureSpringBootRequestHandler.java:44)

Function Execution Fail

Cloned the project locally and followed the steps mentioned and I get the below error

This issue is for the curl command below

curl http://localhost:7071/api/hello -d "{\"name\":\"Azure\"}"

[02/14/2020 13:02:53] Executing 'Functions.hello' (Reason='This function was programmatically called via the host APIs.', Id=59830cdc-0263-4fa2-8e9d-8b1c5ff67e9e)
[02/14/2020 13:02:53] Executed 'Functions.hello' (Failed, Id=59830cdc-0263-4fa2-8e9d-8b1c5ff67e9e)
[02/14/2020 13:02:53] System.Private.CoreLib: Exception while executing function: Functions.hello. System.Private.CoreLib: Result: Failure
[02/14/2020 13:02:53] Exception: ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
[02/14/2020 13:02:53] Stack: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
[02/14/2020 13:02:53]   at com.microsoft.azure.functions.worker.reflect.DefaultClassLoaderProvider.addUrlToSystemClassLoader(DefaultClassLoaderProvider.java:72)
[02/14/2020 13:02:53]   at com.microsoft.azure.functions.worker.reflect.DefaultClassLoaderProvider.addUrl(DefaultClassLoaderProvider.java:62)
[02/14/2020 13:02:53]   at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.addSearchPathsToClassLoader(JavaFunctionBroker.java:64)
[02/14/2020 13:02:53]   at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.loadMethod(JavaFunctionBroker.java:33)
[02/14/2020 13:02:53]   at com.microsoft.azure.functions.worker.handler.FunctionLoadRequestHandler.execute(FunctionLoadRequestHandler.java:27)
[02/14/2020 13:02:53]   at com.microsoft.azure.functions.worker.handler.FunctionLoadRequestHandler.execute(FunctionLoadRequestHandler.java:9)
[02/14/2020 13:02:53]   at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
[02/14/2020 13:02:53]   at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92)
[02/14/2020 13:02:53]   at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[02/14/2020 13:02:53]   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[02/14/2020 13:02:53]   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[02/14/2020 13:02:53]   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[02/14/2020 13:02:53]   at java.base/java.lang.Thread.run(Thread.java:834)
[02/14/2020 13:02:53] .
[02/14/2020 13:02:53] Executed HTTP request: {
[02/14/2020 13:02:53]   "requestId": "ac312cb5-33a4-4585-b703-168206cd827c",
[02/14/2020 13:02:53]   "method": "POST",
[02/14/2020 13:02:53]   "uri": "/api/hello",
[02/14/2020 13:02:53]   "identities": [
[02/14/2020 13:02:53]     {
[02/14/2020 13:02:53]       "type": "WebJobsAuthLevel",
[02/14/2020 13:02:53]       "level": "Admin"
[02/14/2020 13:02:53]     }
[02/14/2020 13:02:53]   ],
[02/14/2020 13:02:53]   "status": 500,
[02/14/2020 13:02:53]   "duration": 12
[02/14/2020 13:02:53] }

Just a side note; my local JDK version is 11 and not 8. But the java version for the project is JDK 8.

I changed my local JDK version to 8 still I get the same issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.