-
Notifications
You must be signed in to change notification settings - Fork 52
could not get type for name org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler from any class loader #132
Comments
I can't see anything obviously wrong other than you may not have it in the classpath. |
I am having these issues too. Tons of "could not get type for name" for spring classes as well as classes generated from annotation processors. |
Just looking at the line that is throwing the exception, it should be looking for either Are you both using java 11? In case that's the cause as it's reflection logic related. |
Yeah, it is definitely the reflection code complaining. I am using Java 8. Works fine with Gradle 4.10 and 1.0.0 of this plugin. Have to use a newer version of the plugin because of
|
Are you specifying the packages property? If so, what is it and where are your annotated classes? Also, @mjparme what is the relationship between MutableAclService and your annotated classes? |
@gigaSproule MutableAclService is found in a dependency of my code, it isn't directly referenced by my annotated class. (which makes this even more odd). My locations only includes a single package, and that is my top-level package of all my code |
@gigaSproule FWIW, I get that error "could not get type for name...from any classloader" for pretty much every class my code references that are in my dependencies, here is another example:
This includes classes that share my top-level package name but are in a dependent jar. |
I have created a test spring boot application that recreates the problem. Just extract the project, cd into the project and execute
What is interesting is if you run it a couple more times it will eventually work. But if you run |
@gigaSproule yes, I'm using Java 11. If it's reflection related, is there something I can do to overcome the issue? Let me know if you want the source code for this.
|
I have the same problem as well. In some cases I could fix it with adding the (missing?!?) dependency to the buildscript classpath. I'm working on a project with spring-cloud at the moment, where I'm using openfeign. The swagger-gradle-plugin has the problem on every feign client (interface), also when I'm using Java 8. I wonder if adding an option to set the classpath (from a gradle configuration) would help. |
I looked a bit more into my openfeign problem. Openfeign interfaces were under (package) When I move the Openfeign package to |
Getting issue similar to above with 1.0.6 plugin ver, on JDK 1.8.202 (Azul).
Mentioning seemingly random classes from jars on classpath. Seems like as soon as any package specified in |
This actually appears to be the trigger for the problem...if I get a chance I might take another look at the source armed with this newfound piece of info. |
We recently ran into a similar problem to this and managed to fix it by adding the classes to the Gradle build class path. It was triggered when we added an interface to one of our resource models:
We are using Kotlin, but checking the generated byte code everything looked fine at a first glance. It was weird that the plugin could fine |
Experienced similar issue:
Addressed issue by applying the same approach as @jonnii build.grade:
|
Check the workaround here #158 (comment) that solves the issue |
I've been having this problem with different versions of the plugin, and different versions of spring-boot. Usually the workaround in #158 comment fixed the problem, but this time it didn't work. The classloader couldn't find any of my classes, but the plugin configuration was correct and the classes in the package configured were only POJOs and basic Controllers. I've ended modifying the workaround to add the main classes to the classloader and it worked. Java Version: 11.0.4 zulu
|
Spring boot version 2.1.1
Java 11
Gradle 5.0
Plugin version 1.0.6
Here's a Gradle scan that shows the error - https://gradle.com/s/m43exduyc4abg
The text was updated successfully, but these errors were encountered: