azure-maven-plugins: [Functions] java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader

Plugin name and version

Functions 1.3.4

Plugin configuration in your pom.xml

Expected behavior

Error with goal: run

Actual behavior

[01/07/2020 18:45:42] Worker failed to function id 354c4307-6b98-450f-9537-1b661153d88a. [01/07/2020 18:45:42] Result: Failure [01/07/2020 18:45:42] 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’) [01/07/2020 18:45:42] 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’)

Steps to reproduce the problem

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 5
  • Comments: 23 (9 by maintainers)

Most upvoted comments

This is because user is using not supported Java version like Java 9 or Java 11. Currently Azure Functions only support Java 8.

We need to stop the execution when jdk is not 8

i am having the same issue. although when i try "java -version" i receive:

openjdk version "1.8.0_222"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.222-b10, mixed mode)

doesnt this mean i am using java 8?

i am having the same issue. although when i try "java -version" i receive:

openjdk version "1.8.0_222"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.222-b10, mixed mode)

doesnt this mean i am using java 8?

@cs4242 Thanks for your support and sorry for the late reply, this should be Java 8 in your PATH, could you please check whether you also install Java 11 and set it as JAVA_HOME, it seem that function worker will uses JAVA_HOME as the java path.