2 Replies Latest reply on Jul 29, 2011 4:21 PM by Jason Porter

    Null Objects With Seam Servlet

    Lee Theobald Newbie

      Hi all,


      I'm trying to get some items injected from Seam Servlet.  Although it injects some form of proxy objects, querying those objects raises a variety of errors all revolving around those proxy objects returning null objects.  Take the below example:


      @Named
      @ConversationScoped
      public class ManagementBean {
      
        @Inject
        private HttpServletRequest httpRequest;
      
        @Inject
        private List<Cookie> cookies;
      
        public void init() throws Exception {
          // Testing the values here
        }
      }
      




      The init method is being reference from a viewAction tag on my JSP page.  When I inspect the httpRequest variable I get something with a simple class name of the following:


      org$jboss$weld$beanProducerMethod-org$jboss$seam$servlet$http$ImplicitHttpServletObjectsProducermethod_getHttpServletRequest()_$$_WeldClientProxy



      So a proxy object, fair enough.  But when I attempt to query something on that request object (e.g. httpRequest.getContentType()), I get an error related to null objects.  In this case it would be:


      org.jboss.weld.exceptions.IllegalProductException: WELD-000052 Cannot return null from a non-dependent producer method:  [method] @Produces @Typed @RequestScoped protected org.jboss.seam.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest()



      For some reason my code can't get it's hands on the HTTP request and I don't know why.  I'm running this code from within Tomcat 6, using Seam version 3.0.0.Final.


      Does anyone have any clues to what's going wrong or what I'm missing?  The Seam Servlet documentation doesn't save I need to do anything but add my injection points.  Injection/CDI is working fine in every other instance I'm using it.


      Cheers for any help,
      Lee