title: WebServiceContext injecting issue via @Resource annotation
body: <p>I am having issues with injecting WebServiceContext via @Resource annotation.
  I am using JAXWS + Spring combination.
  This is a piece of code I use. </p>
  
  <pre><code>@WebService 
  public class AdminWSImpl {
  
    @Resource
    private WebServiceContext context;
  
  ...
  }
  </code></pre>
  
  <p>Part of my web.xml:</p>
  
  <pre><code>...
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  
  &lt;listener&gt;
      &lt;listener-class&gt;com.sun.xml.ws.transport.http.servlet.WSServletContextListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  
  &lt;servlet&gt;
      &lt;description&gt;JAX-WS endpoint of Admin Service&lt;/description&gt;
      &lt;display-name&gt;JAX-WS Admin servlet&lt;/display-name&gt;
      &lt;servlet-name&gt;AdminService&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.sun.xml.ws.transport.http.servlet.WSServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;context&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.context.ContextLoaderServlet&lt;/servlet-class&gt;     
      &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  </code></pre>
  
  <p>The problem is the context is always null!
  According to <a href="https://stackoverflow.com/questions/5820969/how-to-use-resource-webservicecontext-injection-with">How to use @Resource WebServiceContext injection with Spring&#39;s @Transactional</a> springs-transactional I have defined the setter for the context and put the  @Resource annotation on the setter.</p>
  
  <p>The result of putting @Resource annotation on the setter is this stack trace:</p>
  
  <pre><code>SEVERE: WSSERVLET11: failed to parse runtime descriptor:   javax.xml.ws.WebServiceException: Unable to create JAXBContext
  javax.xml.ws.WebServiceException: Unable to create JAXBContext
      at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:171)
      at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:99)
      at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:250)
      at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:343)
      at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:205)
      at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:513)
      at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:257)
      at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:151)
      at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(WSServletContextListener.java:131)
      at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:152)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:563)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1399)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
      at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1500)
      at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:252)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:186)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at com.googlecode.psiprobe.Tomcat60AgentValve.invoke(Tomcat60AgentValve.java:30)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      at java.lang.Thread.run(Thread.java:662)
     Caused by: java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
      javax.xml.ws.WebServiceContext is an interface, and JAXB can't handle interfaces.
      this problem is related to the following location:
  </code></pre>
  
  <p>Can anyone provide any help?</p>
  
  <p>Thank you in advance!</p>