We are trying to move our application from a JSF 1.1 based AS to a JSF 1.2 AS.  
In our current implementation we have the pattern where a XMLHttp browser 
request is made to a servlet which will try to reference the FacesContext in 
the service() method. This all worked under 1.1 just fine but when we deploy 
this to a 1.2 based server we get stack traces like:

java.lang.NullPointerException
        at org.apache.catalina.connector.Request.setAttribute(Request.java:1443)
        at 
org.apache.catalina.connector.RequestFacade.setAttribute(RequestFacade.java:503)
        at com.sun.faces.context.RequestMap.put(ExternalContextImpl.java:1087)
        at 
com.sun.faces.util.RequestStateManager.getStateMap(RequestStateManager.java:281)
        at 
com.sun.faces.util.RequestStateManager.set(RequestStateManager.java:223)
        at 
com.sun.faces.el.FacesCompositeELResolver.setChainType(FacesCompositeELResolver.java:159)
        at 
com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:71)
        at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:61)
        at 
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
        at 
com.sun.faces.application.ValueBindingValueExpressionAdapter.getValue(ValueBindingValueExpressionAdapter.java:113)
        at 
com.salesgene.servlets.tree.TreeNavigationServlet.service(TreeNavigationServlet.java:54)
        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 
com.salesgene.common.filters.UserSessionFilter.doProcessing(UserSessionFilter.java:355)
        at 
com.salesgene.common.filters.UserSessionFilter.doFilter(UserSessionFilter.java:197)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        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:235)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at 
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
        at 
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
        at 
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
        at 
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at 
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
        at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)


This happens in every instance where we try to reference managed beans in a 
servlet. Oh, and we are getting the FacesContext following this approach:

LifecycleFactory lifecycleFactory = (LifecycleFactory)
                FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); 
            Lifecycle lifecycle = 
lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);

            // Create new FacesContext.
            FacesContextFactory contextFactory  = (FacesContextFactory)
                FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
            facesContext = contextFactory.getFacesContext(
                request.getSession().getServletContext(), request, response, 
lifecycle);

            // Create new View.
            UIViewRoot view = 
facesContext.getApplication().getViewHandler().createView(
                facesContext, "");
            facesContext.setViewRoot(view);                

            // Set current FacesContext.
            FacesContextWrapper.setCurrentInstance(facesContext);


Anyhelp or advice would be most appreciated!

-matt


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4236762#4236762

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4236762
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to