Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalArgumentException when using AnnotationUtils.findAnnotation [SPR-13634] #18212

Closed
spring-projects-issues opened this issue Nov 2, 2015 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) in: messaging Issues in messaging modules (jms, messaging) in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Nov 2, 2015

Rossen Stoyanchev opened SPR-13634 and commented

java.lang.IllegalArgumentException: interface org.springframework.messaging.simp.annotation.SendToUser is not visible from class loader
	at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:616)
	at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:592)
	at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:244)
	at java.lang.reflect.WeakCache.get(WeakCache.java:141)
	at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:455)
	at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:738)
	at org.springframework.core.annotation.AnnotationUtils.synthesizeAnnotation(AnnotationUtils.java:1280)
	at org.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:500)
	at org.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:561)
	at org.springframework.messaging.handler.HandlerMethod.getMethodAnnotation(HandlerMethod.java:214)
	at org.springframework.messaging.handler.HandlerMethod$HandlerMethodParameter.getMethodAnnotation(HandlerMethod.java:275)
	at org.springframework.messaging.simp.annotation.support.SendToMethodReturnValueHandler.supportsReturnType(SendToMethodReturnValueHandler.java:136)


Affects: 4.2 GA

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Nov 2, 2015

Rossen Stoyanchev commented

Link to original report:
rstoyanchev/spring-websocket-portfolio#60

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Nov 2, 2015

Juergen Hoeller commented

AnnotationUtils was using the default ClassLoader for the creation of synthesized annotation proxies, which depends on the thread-context ClassLoader or on all jars sharing the same framework ClassLoader. The more reliable choice is to use the ClassLoader that the original annotation has been declared in, which we're doing as of 4.2.3 now.

Juergen

@spring-projects-issues spring-projects-issues added type: bug A general bug in: messaging Issues in messaging modules (jms, messaging) in: core Issues in core modules (aop, beans, core, context, expression) in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.2.3 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) in: messaging Issues in messaging modules (jms, messaging) in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants