Spring MVC - RAML Spec Synchroniser Plugin. A Maven plugin designed to Generate Server & Client code in Spring from a RAML API descriptor and conversely, a RAML API document from the SpringMVC Server implementation.
When the Plugin is executed on a Java 9+ JVM a ClassCastException is thrown:
[ERROR] Could not add schema location to classpath
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')
at com.phoenixnap.oss.ramlplugin.raml2code.plugin.SpringMvcEndpointGeneratorMojo.getSchemaLocation (SpringMvcEndpointGeneratorMojo.java:477)
at com.phoenixnap.oss.ramlplugin.raml2code.plugin.SpringMvcEndpointGeneratorMojo.generateEndpoints (SpringMvcEndpointGeneratorMojo.java:261)
at com.phoenixnap.oss.ramlplugin.raml2code.plugin.SpringMvcEndpointGeneratorMojo.execute (SpringMvcEndpointGeneratorMojo.java:521)
[...]
The Plugin currently adds the Schema Location to the Classpath by getting the SystemClassLoader as an URLClassLoader, but because the underlying SystemClassLoader is no longer a URLClassLoader this results in an Error:
Several threads about this issue describe a workaround by further specifying the Class#forName usage, but as far as I understand this is not feasible for the current impl where it is assumed that the default classloader knowns the schema files.
When the Plugin is executed on a Java 9+ JVM a ClassCastException is thrown:
The Plugin currently adds the Schema Location to the Classpath by getting the SystemClassLoader as an URLClassLoader, but because the underlying SystemClassLoader is no longer a URLClassLoader this results in an Error:
https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/plugin/SpringMvcEndpointGeneratorMojo.java#L492-L499
Several threads about this issue describe a workaround by further specifying the
Class#forName
usage, but as far as I understand this is not feasible for the current impl where it is assumed that the default classloader knowns the schema files.