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

Support @Repeatable in @PayloadRoot and @SoapAction [SWS-877] #952

Closed
gregturn opened this issue Jul 18, 2014 · 9 comments
Closed

Support @Repeatable in @PayloadRoot and @SoapAction [SWS-877] #952

gregturn opened this issue Jul 18, 2014 · 9 comments
Assignees
Milestone

Comments

@gregturn
Copy link
Contributor

Arjen Poutsma opened SWS-877* and commented

Support the JDK 8 @Repeatable annotation in the @SoapAction and @PayloadRoot annotations.


Issue Links:

  • SPR-12889 AnnotatedElementUtils should leniently ignore TypeNotPresentExceptions (just like AnnotationUtils)

Referenced from: commits fe4747d

@gregturn
Copy link
Contributor Author

gregturn commented Apr 2, 2015

Gyula Szalai commented

Because of this mod, our Java6 based project won't run with spring-ws 2.2.1. Is it intentional?

@gregturn
Copy link
Contributor Author

gregturn commented Apr 2, 2015

Arjen Poutsma commented

Gyula Szalai no, it is not. What is the error/stacktrace you are getting?

@gregturn
Copy link
Contributor Author

gregturn commented Apr 3, 2015

Gyula Szalai commented

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ValamiEndpointImpl' defined in URL [jar:file:/valami-ws-1.0.0-SNAPSHOT.jar!/hu/vanio/valami/ws/ValamiEndpointImpl.class]: Post-processing failed of bean type [class hu.vanio.valami.ws.ValamiEndpointImpl] failed; nested exception is java.lang.IllegalStateException: Failed to introspect annotations: public hu.vanio.valami.schema.ValamiValasz hu.vanio.valami.ws.ValamiEndpointImpl.valamiLekerdezes(hu.vanio.valami.schema.ValamiKeres) throws java.lang.Exception
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:936) ~[spring-beans-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512) ~[spring-beans-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spring-beans-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[spring-beans-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-beans-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755) ~[spring-beans-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) ~[spring-context-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) ~[spring-context-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) [spring-boot-1.2.3.RELEASE.jar!/:1.2.3.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686) [spring-boot-1.2.3.RELEASE.jar!/:1.2.3.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) [spring-boot-1.2.3.RELEASE.jar!/:1.2.3.RELEASE]
	at hu.vanio.valami.ValamiWsApplication.main(ValamiWsApplication.java:19) [valami-ws-1.0.0-SNAPSHOT.jar!/:1.0.0-SNAPSHOT]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:6.0]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45) ~[na:6.0]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) ~[na:6.0]
	at java.lang.reflect.Method.invoke(Method.java:599) ~[na:6.0]
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53) [valami-ws-1.0.0-SNAPSHOT.jar!/:1.0.0-SNAPSHOT]
	at java.lang.Thread.run(Thread.java:735) [na:6.0]
Caused by: java.lang.IllegalStateException: Failed to introspect annotations: public hu.vanio.valami.schema.ValamiValasz hu.vanio.valami.ws.ValamiEndpointImpl.valamiLekerdezes(hu.vanio.valami.schema.ValamiKeres) throws java.lang.Exception
	at org.springframework.core.annotation.AnnotatedElementUtils.process(AnnotatedElementUtils.java:166) ~[spring-core-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.core.annotation.AnnotatedElementUtils.getAnnotationAttributes(AnnotatedElementUtils.java:91) ~[spring-core-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.core.annotation.AnnotatedElementUtils.getAnnotationAttributes(AnnotatedElementUtils.java:85) ~[spring-core-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.findAutowiredAnnotation(AutowiredAnnotationBeanPostProcessor.java:434) ~[spring-beans-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.buildAutowiringMetadata(AutowiredAnnotationBeanPostProcessor.java:407) ~[spring-beans-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.findAutowiringMetadata(AutowiredAnnotationBeanPostProcessor.java:370) ~[spring-beans-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(AutowiredAnnotationBeanPostProcessor.java:233) ~[spring-beans-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:931) ~[spring-beans-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	... 19 common frames omitted
Caused by: java.lang.TypeNotPresentException: Type java.lang.annotation.Repeatable not present
	at com.ibm.oti.reflect.AnnotationHelper.getAnnotation(AnnotationHelper.java:38) ~[na:na]
	at com.ibm.oti.reflect.AnnotationHelper.getDeclaredAnnotations(AnnotationHelper.java:50) ~[na:na]
	at java.lang.Class.getDeclaredAnnotations(Class.java:1628) ~[na:6.0]
	at java.lang.Class.getAnnotations(Class.java:1589) ~[na:6.0]
	at org.springframework.core.annotation.AnnotatedElementUtils.doProcess(AnnotatedElementUtils.java:192) ~[spring-core-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.core.annotation.AnnotatedElementUtils.doProcess(AnnotatedElementUtils.java:209) ~[spring-core-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	at org.springframework.core.annotation.AnnotatedElementUtils.process(AnnotatedElementUtils.java:162) ~[spring-core-4.1.6.RELEASE.jar!/:4.1.6.RELEASE]
	... 26 common frames omitted
Caused by: java.lang.ClassNotFoundException: java.lang.annotation.Repeatable
	at java.lang.Class.forNameImpl(Native Method) ~[na:6.0]
	at java.lang.Class.forName(Class.java:169) ~[na:6.0]
	at com.ibm.oti.reflect.AnnotationHelper.getAnnotation(AnnotationHelper.java:33) ~[na:na]
	... 32 common frames omitted

@gregturn
Copy link
Contributor Author

gregturn commented Apr 3, 2015

Gyula Szalai commented

It's a Spring Boot application, that runs on AIX 5.3 and IBM Java6.
This error appeared after upgrading Spring-Boot from 1.2.2 to 1.2.3.
At first, I thought it was caused by the newer spring-core version,
but after fiddling around a bit, it turned out that if we downgraded spring-ws
to 2.2.0 the problem disappeared.

@gregturn
Copy link
Contributor Author

gregturn commented Apr 3, 2015

Arjen Poutsma commented

I am not convinced that this is a Spring-WS bug, as our use of Repeatable is identical to what Spring does:

https://github.com/spring-projects/spring-framework/blob/master/spring-context/src/main/java/org/springframework/context/annotation/PropertySource.java#L147

This should work under JDK 6 or 7, since annotations that cannot be found in the JDK should simply be ignored. It seems more likely that this is some sort of annotation-introspection bug that occurs in IBM JDKs. I will ask around and investigate further.

@gregturn
Copy link
Contributor Author

gregturn commented Apr 3, 2015

Gyula Szalai commented

OK, thank you in advance.

@gregturn
Copy link
Contributor Author

gregturn commented Apr 3, 2015

Juergen Hoeller commented

Indeed, Spring Web Services uses the same approach as some of the annotations in Spring Framework 4.x itself. Let's rather revisit Spring's core AnnotatedElementUtils to be more defensive towards TypeNotPresentExceptions, in particular when calling Class.getDeclaredAnnotations() instead of Class.getAnnotations(). Could you please create a corresponding SPR issue for this?

For better or for worse, IBM's JDK 6 is pretty special there, having peculiar rules with respect to nested type resolution within method bodies as well. Note that as of JDK 7, IBM's JDKs are derived from OpenJDK and therefore naturally more in line with Oracle's established JDK behavior. If you have any chance to do so, you could run this on IBM JDK 7, just to see whether the problem goes away...

Actually, it might even help to upgrade to the latest IBM JDK 6 version, assuming you might be using an older variant there?

Juergen

@gregturn
Copy link
Contributor Author

gregturn commented Apr 3, 2015

Gyula Szalai commented

Thanks Jürgen! Actually we used a very-very old IBM JDK6 version. Unfortunately this server is stuck
with AIX 5.3 so, JDK6 is the maximum. Our ops team upgraded it to the latest (2014dec)
version and the problem has vanished :)

Shall I file an SPR issue or it can be closed?

@gregturn
Copy link
Contributor Author

gregturn commented Apr 3, 2015

Juergen Hoeller commented

Alright, I'm glad to hear that it works for you now :-)

No need to create an SPR issue for this one then. I'm nevertheless going to revisit our annotation introspection exception handling but will do so under a different umbrella.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants