title: cdi - javax.enterprise.context.ContextNotActiveException while using scoped beans in @Producer methods
body: <p>I'm using <strong>Websphere Application Server 8.0.0.5</strong> and I've observed the following issues while using CDI.</p>
  
  <blockquote>
    <ol>
    <li>Classes which have <code>@Producer</code> methods cannot have any scope other than <code>@Dependent</code></li>
    <li>Any bean whose scope is other than <code>@Dependent</code> cannot be injected and used in classes with <code>@Producer</code> methods.</li>
    </ol>
  </blockquote>
  
  <p>On doing any of the above task, I get:</p>
  
  <pre><code>[10/8/15 14:50:30:764 GMT+05:30] 00000019 InjectInjecti E   CWOWB0102E: A JCDI error has occurred: WebBeans context with scope type annotation @ApplicationScoped does not exist within current thread
  [10/8/15 14:50:30:766 GMT+05:30] 00000019 BusinessExcep E   CNTR0019E: EJB threw an unexpected (non-declared) exception during invocation of method "doSomething". Exception data: javax.ejb.EJBException: Injection failure; nested exception is: javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @ApplicationScoped does not exist within current thread
  javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @ApplicationScoped does not exist within current thread
          at org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:321)
          at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.getContextualInstance(NormalScopedBeanInterceptorHandler.java:124)
          at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:95)
  
  ......
  </code></pre>
  
  <p>Sample code to replicate the issue:</p>
  
  <pre><code>public class Producer{
  
      @Inject
      @MyQualifier
      private Properties properties;
  
      @Produces
      public Logger getLogger(InjectionPoint ip){
          System.out.println(properties);
          System.out.println("Injection point is: "+ip);
          return Logger.getLogger(ip.getMember().getDeclaringClass().getName());
      }
  
  
  }
  
  
  
  
  
  public class AnotherProducer{
  
      @Produces
      @MyQualifier
      @ApplicationScoped
      public Properties getProperties(){
  
          Popperties p = new Properties();
          p.put("key","value");
  
          return p;
      }   
  }
  </code></pre>
  
  <p>My question here is - Am I violating the CDI spec or there's something wrong with my Container?</p>