Hi all,

I´m trying to inject a WebServiceContext using:

@Resource
private WebServiceContext context;

Put I´m ussing <tx:annotation-driven order="1"/> in my beans.xml and
the class where I want the WebServiceContext is being proxyed because
of transactions.

I read:
https://issues.apache.org/jira/browse/CXF-1074

Daniel Kulp says:
"There are a couple ways around this now. The easiest is to import
META-INF/cxf/cxf-extension-jaxws.xml which will register a listener to
make sure the WebServiceContext is injected into any bean that uses
it."

I tried:

<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml" />
 in my bean.xml

but I´m still getting:

SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'ticketSenderService': Invocation of init
method failed; nested exception is javax.xml.ws.WebServiceException:
Creation of Endpoint failed
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
        at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
        at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
        at 
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
        at 
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
        at 
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
        at 
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
        at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
        at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)
        at 
org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:719)
        at 
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1217)
        at 
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
        at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at 
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
        at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
        at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
        at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.xml.ws.WebServiceException: Creation of Endpoint failed
        at 
org.apache.cxf.jaxws.JaxWsServerFactoryBean.init(JaxWsServerFactoryBean.java:182)
        at 
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:169)
        at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:336)
        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:251)
        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:201)
        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:394)
        at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1413)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1374)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
        ... 31 more
Caused by: java.lang.IllegalArgumentException: Can not set
javax.xml.ws.WebServiceContext field
edeploy.ticketsender.webservice.TicketSenderServiceImpl.context to
$Proxy60
        at 
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
        at 
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
        at 
sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37)
        at 
sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:57)
        at java.lang.reflect.Field.set(Field.java:657)
        at 
org.apache.cxf.common.injection.ResourceInjector.injectField(ResourceInjector.java:283)
        at 
org.apache.cxf.common.injection.ResourceInjector.visitField(ResourceInjector.java:167)
        at 
org.apache.cxf.common.annotation.AnnotationProcessor.processFields(AnnotationProcessor.java:101)
        at 
org.apache.cxf.common.annotation.AnnotationProcessor.accept(AnnotationProcessor.java:69)
        at 
org.apache.cxf.common.injection.ResourceInjector.inject(ResourceInjector.java:81)
        at 
org.apache.cxf.jaxws.JaxWsServerFactoryBean.injectResources(JaxWsServerFactoryBean.java:222)
        at 
org.apache.cxf.jaxws.JaxWsServerFactoryBean.init(JaxWsServerFactoryBean.java:176)

If I remove the @Transactional, there is no errors.

Any other work around?

Thank you,

Eduardo

Reply via email to