title: Why can't I inject a WebServiceContext into a Jax-WS logical Handler
body: <p>I have this logical handler for a web service that I need to get access to the servlet's context (via the web service context, I am thinking).</p>
  
  <pre><code>package test;
  
  public class NewLogicalHandler implements LogicalHandler&lt;LogicalMessageContext&gt; {
  
     @Resource
     private WebServiceContext context; 
  </code></pre>
  
  <p>Error when I deploy:</p>
  
  <pre><code>&lt;Servlet: "test.ws1" failed to preload on startup in Web application: "web".
  java.lang.ClassNotFoundException: test.NewLogicalHandler
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  </code></pre>
  
  <p>If I inject into the web service proper:</p>
  
  <pre><code>@WebService(..stuff...)
  @HandlerChain(file = "handler.xml")
  public class ws1 {
  
     @Resource
     private WebServiceContext context;      
  </code></pre>
  
  <p>That works fine.</p>