I have developed an Azure Serverless Function in Eclipse. The function works locally (Run As/Maven/Set Goals=test) but does not work once deployed. It fails with the following error
[Error] Executed 'Functions.HttpExample' (Failed, Id=0de9ae96-68c6-4620-ba05-63a1c1c99b97,
Duration=24ms)
Result: FailureException: NoClassDefFoundError:
javax/servlet/http/HttpServletStack: java.lang.reflect.InvocationTargetExceptionat
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at
I can see from looking at the code that it is failing at the following line.
boolean tokenVerified = RecaptchaVerification.verifyRecaptchaSite(token);
This is the first line in the code that references a class not in Function.java
Here is the structure of the code in Eclipse
I have used WinSCP and the publish profile credentials to examine what has been deployed.
Everything is there
Does anybody know how to solve this problem? I could put all the code into Function.java and this would work, but I would prefer to solve this properly. (Incidentally the same issue happened to me when I did development in Visual Studio Code)
UPDATE: I tried the following also - but to no avail.
- I tried running on Java 11 instead of Java 8 (with appropriate changes to the pom.xml file) and trying different versions of
FUNCTIONS_EXTENSION_VERSION. - I made sure the
artifactIDwas different from thefunctionAppName, and that both were in lowercase. - I tried updating the
javax.servletversion inpom.xml

