Are you sure that you are declaring the @Resource correctly in your
service class? The reason that I ask is I use the following with
success:
ApplicationContext.xml
<bean id="webServiceContextImpl"
class="org.apache.cxf.jaxws.context.WebServiceContextImpl">
</bean>
Service class
@Resource(name = "webServiceContextImpl")
private WebServiceContext wsContext;
So, I reference the @Resource by its bean id. I'm not sure, from the
error message that you attached, that you are referencing the bean id
name in the service class.
Ron
-----Original Message-----
From: Karthik Abram [mailto:[email protected]]
Sent: Tuesday, May 05, 2009 11:23 AM
To: [email protected]
Subject: RE: @Resource injection fails in 2.2.1
Try the following:
Add <bean
class="org.springframework.context.annotation.CommonAnnotationBeanPostPr
oces
sor"/>
-----Original Message-----
From: nicolas de loof [mailto:[email protected]]
Sent: Tuesday, May 05, 2009 4:39 AM
To: [email protected]
Subject: @Resource injection fails in 2.2.1
Hi
I'm using <jaxws:endpoint to expose my web services, generated using
wsdl2java :
<jaxws:endpoint address="/consultation/1.0"
implementor="#consultationEndPoint"
wsdlLocation="wsdl/consultation_v1.0.wsdl"/>
<bean id="consultationEndPoint" class="com.foo.ConsultationEndPoint"
/>
My EndPoint uses @Resource annotation to get Spring business-layer
beans.
I get an error on CXF 2.2.1 :
Caused by: java.lang.IllegalArgumentException: Can not set
com.foo.ConsultationService field com.foo.ConsultationEndPoint.service
to
$Proxy176
at
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Uns
afeF
ieldAccessorImpl.java:146)
The resource injector seems to use the proxy generated by
<jaxws:endpoint> for resource injection and not the implementor bean.
Nicolas