Hi ,
It looks like Spring 2.5 will take the charge of the dependency
injection of the WebServiceContext.
CXF can do it with itself Resource Injector, but Spring can't resolve
the WebServiceContext instance.
If you can turn off the Spring 2.5 annotation resource injection feature
, I think you can resolve this issue.
Willem.
gweb79 wrote:
Hello,
Setup:
Spring 2.5 (Configured using annotations)
CXF 2.0.3
Tomcat 6.0.14
I need to access the HTTPServletRequest from the web service impl class. I
have had a look at all the docs which say to add the code:
@Resource
private WebServiceContext context;
which the request can be retrieved. However in my setup I get the following
error:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No unique bean of type [javax.xml.ws.WebServiceContext] is defined:
Unsatisfied dependency of type [interface javax.xml.ws.WebServiceContext]:
expected at least 1 matching bean
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveDependency(AbstractAutowireCapableBeanFactory.java:417)
at
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:384)
at
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:463)
at
org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:123)
at
org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:61)
at
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessAfterInstantiation(CommonAnnotationBeanPostProcessor.java:259)
... 53 more
Can anybody explain what the problem is? The docs make it seem very simple.
I have setup the web.xml with
org.springframework.web.context.request.RequestContextListener.
If this is not possible with my setup is there any other way to access the
request from the web service? I need to access the user information in
multiple places for each individual request?
Thanks.