Hello,
we discovered a problem today. We use the Spring integration of the JAX-WS webservice and this was working pretty fine so far.
An example of how our Webservice looks like can be found here, as it is pretty similar:
http://www.tutego.com/blog/javainsel/labels/Java.html
Today we started to add the @Transactional annotations to some methods. Suddenly we got the following exceptions:
Code:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jax-ws.http' defined in file [C:\Dev\workspace\myProjectDomain\src\web\WEB-INF\myProjectDomain-webServices.xml]: Cannot create inner bean 'wss:binding#11c2b67' of type [com.sun.xml.ws.transport.http.servlet.SpringBinding] while setting bean property 'bindings' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wss:binding#11c2b67' defined in file [C:\Dev\workspace\myProjectDomain\src\web\WEB-INF\myProjectDomain-webServices.xml]: Cannot create inner bean '(inner bean)' of type [org.jvnet.jax_ws_commons.spring.SpringService] while setting bean property 'service'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: class de.myCompany.myProject.services.lager.LagerService$$EnhancerByCGLIB$$35598ee0 has neither @WebSerivce nor @WebServiceProvider annotation Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wss:binding#11c2b67' defined in file [C:\Dev\workspace\myProjectDomain\src\web\WEB-INF\myProjectDomain-webServices.xml]: Cannot create inner bean '(inner bean)' of type [org.jvnet.jax_ws_commons.spring.SpringService] while setting bean property 'service'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: class de.myCompany.myProject.services.lager.LagerService$$EnhancerByCGLIB$$35598ee0 has neither @WebSerivce nor @WebServiceProvider annotation Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: class de.myCompany.myProject.services.lager.LagerService$$EnhancerByCGLIB$$35598ee0 has neither @WebSerivce nor @WebServiceProvider annotation Caused by: java.lang.IllegalArgumentException: class de.myCompany.myProject.services.lager.LagerService$$EnhancerByCGLIB$$35598ee0 has neither @WebSerivce nor @WebServiceProvider annotation at com.sun.xml.ws.server.EndpointFactory.verifyImplementorClass(EndpointFactory.java:273) at org.jvnet.jax_ws_commons.spring.SpringService.getObject(SpringService.java:311) at org.jvnet.jax_ws_commons.spring.SpringService.getObject(SpringService.java:44)
I had a look into the sourcecode of the place where the exception is thrown, which can be found here:
http://fisheye5.cenqua.com/browse/ja...ava?r=1.4#l273
It looks like clz.getAnnotation(WebService.class); doesn't find the right annotation when there are other annotations present.Code:/** 273 * Verifies if the endpoint implementor class has @WebService or @WebServiceProvider 274 * annotation 275 * 276 * @return 277 * true if it is a Provider or AsyncProvider endpoint 278 * false otherwise 279 * @throws java.lang.IllegalArgumentException 280 * If it doesn't have any one of @WebService or @WebServiceProvider 281 * If it has both @WebService and @WebServiceProvider annotations 282 */ 283 public static boolean verifyImplementorClass(Class<?> clz) { 284 WebServiceProvider wsProvider = clz.getAnnotation(WebServiceProvider.class); 285 WebService ws = clz.getAnnotation(WebService.class); 286 if (wsProvider == null && ws == null) { 287 throw new IllegalArgumentException(clz +" has neither @WebSerivce nor @WebServiceProvider annotation"); 288 } 289 if (wsProvider != null && ws != null) { 290 throw new IllegalArgumentException(clz +" has both @WebSerivce and @WebServiceProvider annotations"); 291 } 292 if (wsProvider != null) { 293 if (Provider.class.isAssignableFrom(clz) || AsyncProvider.class.isAssignableFrom(clz)) { 294 return true; 295 } 296 throw new IllegalArgumentException(clz +" doesn't implement Provider or AsyncProvider interface"); 297 } 298 return false; 299 }
After we removed ALL @Transactional annotations it worked pretty fine again. FYI: Annotation driven Transaction handling is properly configured in Spring context and already working in other class which are NO webservices. Only in JAXWS Webservice annotated classes we get these problems.
We will try now to use Spring's TransactionTemplate to circumvent this problem and get Transaction handling but annotations would be much better.
Does anybody have an explanation for this problem or a solution?
Thanks
Christoph


Reply With Quote
. Thought about using AspectJ as an alternative - not tried yet. Couldn't find anything in google concerning AspectJ and inherited annotations so I hadn't much hope. But I will try it as you suggest. Thanks.
