You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Dalton Iwazaki (JIRA)" <de...@myfaces.apache.org> on 2009/11/13 21:24:39 UTC

[jira] Updated: (MYFACES-2218) We have the error : context must not be null in VariableResolverImpl, in MyFaces during the execution of the system.

     [ https://issues.apache.org/jira/browse/MYFACES-2218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dalton Iwazaki updated MYFACES-2218:
------------------------------------

    Status: Patch Available  (was: Open)

> We have the error : context must not be null in VariableResolverImpl, in MyFaces during the execution of the system.
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-2218
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2218
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 1.2.3
>         Environment: We are using Weblogic Server 10.0MP1, RedHat Enterprise Server 4, and JVM is JRockit 5.0.11
>            Reporter: Eduardo Felter Simone
>            Priority: Critical
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> We receive the following error:
> 24 Abr 2009 11:11:43,895 ERROR StackTrace:
> java.lang.NullPointerException: context must not be null
> at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:47)
> at org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(VariableResolverToELResolver.java:93)
> at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.access$301(FacesCompositeELResolver.java:46)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver$4.invoke(FacesCompositeELResolver.java:108)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.invoke(FacesCompositeELResolver.java:148)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:104)
> at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:68)
> at com.sun.el.parser.AstNot.getValue(AstNot.java:46)
> at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
> at javax.faces.component._ComponentUtils.getExpressionValue(_ComponentUtils.java:233)
> at javax.faces.component.UIComponentBase.getExpressionValue(UIComponentBase.java:1155)
> at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1225)
> at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:685)
> at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:688)
> at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:238)
> at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:409)
> at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
> at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
> at pt.ptinovacao.components.aeolus.web.servlet.AeolusFacesServlet.service(AeolusFacesServlet.java:148)
> at br.com.vivo.vivo360.ui.servlet.Vivo360FacesServlet.service(Vivo360FacesServlet.java:82)
> at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
> at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
> at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
> at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
> at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
> at br.com.vivo.vivo360.ui.servlet.SessionExpiredFilter.doFilter(SessionExpiredFilter.java:51)
> at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
> at br.com.vivo.vivo360.ui.servlet.ErrorFilter.doFilter(ErrorFilter.java:63)
> at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
> at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
> at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
> at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
> at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
> at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
> at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
> at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
> at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:26)
> at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
> at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3393)
> at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
> at weblogic.security.service.SecurityManager.runAs(Unknown Source)
> at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2140)
> at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2046)
> at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
> at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
> at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
> 24 Abr 2009 11:16:09,158 ERROR StackTrace:
> java.lang.NullPointerException: context must not be null
> at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:47)
> at org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(VariableResolverToELResolver.java:93)
> at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.access$301(FacesCompositeELResolver.java:46)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver$4.invoke(FacesCompositeELResolver.java:108)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.invoke(FacesCompositeELResolver.java:148)
> at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:104)
> at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:68)
> at com.sun.el.parser.AstNot.getValue(AstNot.java:46)
> at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
> at javax.faces.component._ComponentUtils.getExpressionValue(_ComponentUtils.java:233)
> at javax.faces.component.UIComponentBase.getExpressionValue(UIComponentBase.java:1155)
> at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1225)
> at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:685)
> at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:688)
> at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:238)
> at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:409)
> at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
> at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
> at pt.ptinovacao.components.aeolus.web.servlet.AeolusFacesServlet.service(AeolusFacesServlet.java:148)
> at br.com.vivo.vivo360.ui.servlet.Vivo360FacesServlet.service(Vivo360FacesServlet.java:82)
> at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
> at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
> at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
> at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
> at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
> at br.com.vivo.vivo360.ui.servlet.SessionExpiredFilter.doFilter(SessionExpiredFilter.java:51)
> at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
> at br.com.vivo.vivo360.ui.servlet.ErrorFilter.doFilter(ErrorFilter.java:63)
> at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
> at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
> at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
> at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
> at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
> at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
> at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
> at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
> at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:26)
> at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
> at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3393)
> at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
> at weblogic.security.service.SecurityManager.runAs(Unknown Source)
> at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2140)
> at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2046)
> at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
> at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
> at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
> After occurs the error the server do not answer JSF requests. If we try a JSP page the server works fine. 
> If we wait the server kill all sessions by timeout, after that the server start to answer JSF request and come back to work normally.
> It follows below the sources of filters and servlets that we use in the project:
> ******************************
> --> Web.xml
> ******************************
> <?xml version="1.0"?>
> 	<!--
> 		Licensed to the Apache Software Foundation (ASF) under one or more
> 		contributor license agreements. See the NOTICE file distributed with
> 		this work for additional information regarding copyright ownership.
> 		The ASF licenses this file to you under the Apache License, Version
> 		2.0 (the "License"); you may not use this file except in compliance
> 		with the License. You may obtain a copy of the License at
> 		http://www.apache.org/licenses/LICENSE-2.0 Unless required by
> 		applicable law or agreed to in writing, software distributed under the
> 		License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
> 		CONDITIONS OF ANY KIND, either express or implied. See the License for
> 		the specific language governing permissions and limitations under the
> 		License.
> 	-->
> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
> 	<display-name>vivo360</display-name>
> 	<context-param>
> 		<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
> 		<param-value>server</param-value>
> 	</context-param>
> 	<context-param>
> 		<param-name>javax.faces.CONFIG_FILES</param-name>
> 		<param-value>/WEB-INF/faces-config.xml,
> 			/WEB-INF/migracaocdma-faces-config.xml,
> 			/WEB-INF/migracaogsm-faces-config.xml,
> 			/WEB-INF/habilitacao-faces-config.xml,
> 			/WEB-INF/trocarplano-faces-config.xml,
> 			/WEB-INF/trocaraparelhocdmapre-faces-config.xml,
> 			/WEB-INF/menu-faces-config.xml,
> 			/WEB-INF/venderprodutosavulsos-faces-config.xml,
> 			/WEB-INF/trocarchip-faces-config.xml,
> 			/WEB-INF/trocarNumero-faces-config.xml,
> 			/WEB-INF/consultaHistoricoDetalheInteracao-faces-config.xml,
> 			/WEB-INF/trocarNumero-faces-config.xml,
> 			/WEB-INF/manterdadoslinha-faces-config.xml,
> 			/WEB-INF/atualizacaomodeloaparelho-faces-config.xml,
> 			/WEB-INF/consultaextratodetalhado-faces-config.xml,
> 			/WEB-INF/desbloqueiolinha-faces-config.xml,
> 			/WEB-INF/consultaPuk-faces-config.xml,
> 			/WEB-INF/consultarSenhasRecarga-faces-config.xml,
> 			/WEB-INF/trocararearegistro-faces-config.xml,
> 			/WEB-INF/desprogramarlinha-faces-config.xml,
> 			/WEB-INF/historicorecarga-faces-config.xml,
> 			/WEB-INF/desbloquearsimlock-faces-config.xml,
> 			/WEB-INF/bloquearaparelholinha-faces-config.xml,
> 			/WEB-INF/sincronizar-linha-faces-config.xml,
> 			/WEB-INF/consultaNotaFiscalRecarga-faces-config.xml,
> 			/WEB-INF/reuso-faces-config.xml
> 			</param-value>
> 	</context-param>
> 	<context-param>
> 		<description>
> 			If true, rendered HTML code will be formatted, so
> 			that it is "human readable". i.e. additional line 
> 			separators and whitespace will be written, that do
> 			not influence the HTML code. Default: "true"
> 		</description>
> 		<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
> 		<param-value>false</param-value>
> 	</context-param>
> 	<context-param>
> 		<param-name>org.apache.myfaces.USE_ENCRYPTION</param-name>
> 		<param-value>false</param-value>
> 	</context-param>
> 	<context-param>
> 		<description>
> 			Validate managed beans, navigation rules and
> 			ensure that forms are not nested.
> 		</description>
> 		<param-name>org.apache.myfaces.VALIDATE</param-name>
> 		<param-value>false</param-value>
> 	</context-param>
> 	<context-param>
> 		<param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name>
> 		<param-value>false</param-value>
> 	</context-param>
> 	<context-param>
> 		<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
> 		<param-value>false</param-value>
> 	</context-param>
> 	<context-param>
> 		<param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
> 		<param-value>60</param-value>
> 	</context-param>
> 	<context-param>
> 		<param-name>org.apache.myfaces.NUMBER_OF_LOGICAL_VIEWS</param-name>
> 		<param-value>20</param-value>
> 	</context-param>
> 	<context-param>
> 		<param-name>org.richfaces.SKIN</param-name>
> 		<param-value>DEFAULT</param-value>
> 	</context-param>
> 	
> 	<!-- Configurações do Spring -->
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>classpath:/spring/nfo-application-context.xml</param-value>
> 	</context-param>
> 	<context-param>
> 		<param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
> 		<param-value>false</param-value>
> 	</context-param>
> 	<filter>
> 		<filter-name>ajax4jsf</filter-name>
> 		<filter-class>org.ajax4jsf.webapp.TidyFilter</filter-class>
> 		<init-param>
> 			<param-name>forceparser</param-name>
> 			<param-value>false</param-value>
> 		</init-param>
> 	</filter>
> 	<filter>
> 		<filter-name>MyFacesExtensionsFilter</filter-name>
> 		<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
> 	</filter>
> 	<filter>
> 		<filter-name>ErrorFilter</filter-name>
> 		<filter-class>br.com.vivo.vivo360.ui.servlet.ErrorFilter</filter-class>
> 		<init-param>
> 			<param-name>errorPage</param-name>
> 			<param-value>/jsp/erro/Erro.jsf</param-value>
> 		</init-param>
> 	</filter>
> 	<filter>
> 		<filter-name>SessionExpiredFilter</filter-name>
> 		<filter-class>br.com.vivo.vivo360.ui.servlet.SessionExpiredFilter</filter-class>
> 		<init-param>
> 			<param-name>sessionExpiredPage</param-name>
> 			<param-value>/jsp/inicio/Autenticacao.jsf</param-value>
> 		</init-param>
> 	</filter>
> 	<filter>
> 		<filter-name>Cache Resource</filter-name>
> 		<filter-class>br.com.vivo.vivo360.ui.servlet.CacheResourceFilter</filter-class>
> 		<init-param>
> 			<param-name>hourToExpire</param-name>
> 			<param-value>8</param-value>
> 		</init-param>
> 	</filter>
> 	<filter-mapping>
> 		<filter-name>Cache Resource</filter-name>
> 		<url-pattern>*.js</url-pattern>
> 		<url-pattern>*.gif</url-pattern>
> 		<url-pattern>*.css</url-pattern>
> 		<url-pattern>*.jpg</url-pattern>
> 		<url-pattern>*.xcss</url-pattern>
> 		<dispatcher>REQUEST</dispatcher>
> 		<dispatcher>FORWARD</dispatcher>
> 		<dispatcher>INCLUDE</dispatcher>
> 	</filter-mapping>
> 	<filter-mapping>
> 		<filter-name>ajax4jsf</filter-name>
> 		<servlet-name>Faces Servlet</servlet-name>
> 		<dispatcher>REQUEST</dispatcher>
> 		<dispatcher>FORWARD</dispatcher>
> 		<dispatcher>INCLUDE</dispatcher>
> 	</filter-mapping>
> 	<filter-mapping>
> 		<filter-name>MyFacesExtensionsFilter</filter-name>
> 		<servlet-name>Faces Servlet</servlet-name>
> 		<dispatcher>REQUEST</dispatcher>
> 		<dispatcher>FORWARD</dispatcher>
> 		<dispatcher>INCLUDE</dispatcher>
> 	</filter-mapping>
> 	<filter-mapping>
> 		<filter-name>ErrorFilter</filter-name>
> 		<servlet-name>Faces Servlet</servlet-name>
> 		<dispatcher>REQUEST</dispatcher>
> 		<dispatcher>FORWARD</dispatcher>
> 		<dispatcher>INCLUDE</dispatcher>
> 	</filter-mapping>
> 	<filter-mapping>
> 		<filter-name>SessionExpiredFilter</filter-name>
> 		<servlet-name>Faces Servlet</servlet-name>
> 		<dispatcher>REQUEST</dispatcher>
> 		<dispatcher>FORWARD</dispatcher>
> 		<dispatcher>INCLUDE</dispatcher>
> 	</filter-mapping>
> 	<listener>
> 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
> 	<listener>
> 		<listener-class>
> 			org.springframework.web.context.request.RequestContextListener</listener-class>
> 	</listener>
> 	<listener>
> 		<listener-class>
> 			br.com.vivo.vivo360.ui.listener.Vivo360SessionListener</listener-class>
> 	</listener>
> 	<!-- Faces Servlet -->
> 	<servlet>
> 		<servlet-name>Faces Servlet</servlet-name>
> 		<servlet-class>br.com.vivo.vivo360.ui.servlet.Vivo360FacesServlet</servlet-class>
> 		<init-param>
> 			<param-name>errorPage</param-name>
> 			<param-value>/jsp/erro/Erro.jsf</param-value>
> 		</init-param>
> 		<init-param>
> 			<param-name>authenticationPage</param-name>
> 			<param-value>/jsp/inicio/Autenticacao.jsf</param-value>
> 		</init-param>
> 		<init-param>
> 			<param-name>changePasswordPage</param-name>
> 			<param-value>/jsp/inicio/TrocarSenha.jsf</param-value>
> 		</init-param>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<!-- Faces Servlet Mapping -->
> 	<servlet-mapping>
> 		<servlet-name>Faces Servlet</servlet-name>
> 		<url-pattern>*.jsf</url-pattern>
> 	</servlet-mapping>
> 	<session-config>
> 		<session-timeout>10</session-timeout>
> 	</session-config>
> 	<welcome-file-list>
> 		<welcome-file>index.jsp</welcome-file>
> 	</welcome-file-list>
> 	<login-config>
> 		<auth-method>BASIC</auth-method>
> 	</login-config>
> </web-app>
> *******************************
> --> AeolusFacesServlet
> *******************************
> /**
>  * Projeto: VIVO360
>  * CustomServlet.java
>  * Descrição: Servlet que substitui o Servlet Padrão do Faces.
>  *
>  *@author     <a href="mailto:sdcs-d-gargaro@ptinovacao.pt">Diego S Gargaro</a>
>  *@created    Jun 17, 2008
>  *@version    $Id: AeolusFacesServlet.java,v 1.10 2009/04/16 13:00:02 xsdc743 Exp $
>  */
> package pt.ptinovacao.components.aeolus.web.servlet;
> import java.io.IOException;
> import javax.faces.FactoryFinder;
> import javax.faces.webapp.FacesServlet;
> import javax.servlet.ServletConfig;
> import javax.servlet.ServletException;
> import javax.servlet.ServletRequest;
> import javax.servlet.ServletResponse;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
> import org.apache.log4j.Logger;
> import org.apache.myfaces.shared_impl.webapp.webxml.DelegatedFacesServlet;
> import pt.ptinovacao.components.aeolus.web.session.AeolusSessionManager;
> /**
>  * @author Diego S Gargaro
>  */
> public class AeolusFacesServlet extends HttpServlet implements
> 		DelegatedFacesServlet {
> 	/**
>      * Objeto que contém as propriedades do log4j para criar o log.
>      */
>     private static final Logger LOGGER = Logger.getLogger(AeolusFacesServlet.class);
> 	
> 	/**
> 	 * Serial.
> 	 */
> 	private static final long serialVersionUID = 1L;
> 	/**
> 	 * Nome do parâmetro a ser buscado no web.xml que conterá o valor da página
> 	 * de autenticação.
> 	 */
> 	private static final String INIT_PARAM_AUTHENTICATION_PAGE = "authenticationPage";
> 	/**
> 	 * Nome do parâmetro a ser buscado no web.xml que conterá o valor da página
> 	 * de troca de senha.
> 	 */
> 	private static final String INIT_PARAM_CHANGE_PASSWORD_PAGE = "changePasswordPage";
> 	/**
> 	 * Servlet do Faces.
> 	 */
> 	private FacesServlet delegate;
> 	/**
> 	 * URL da página de autenticação à partir do contextPath.
> 	 */
> 	private String authenticationPage;
> 	/**
> 	 * URL da página de troca de senha à partir do contextPath.
> 	 */
> 	private String changePasswordPage;
> 	/**
> 	 * {@inheritDoc}
> 	 */
> 	public void init(final ServletConfig servletConfig) throws ServletException {
> 		delegate = new FacesServlet();
> 		// ******** Necessário à partir da versão 1.2 do MyFaces ********
> 		// -------- Configura manualmente cada factory ------------------
> 		FactoryFinder.setFactory(FactoryFinder.FACES_CONTEXT_FACTORY,
> 				"org.apache.myfaces.context.FacesContextFactoryImpl");
> 		FactoryFinder.setFactory(FactoryFinder.LIFECYCLE_FACTORY,
> 				"org.apache.myfaces.lifecycle.LifecycleFactoryImpl");
> 		FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY,
> 				"org.apache.myfaces.application.ApplicationFactoryImpl");
> 		FactoryFinder.setFactory(FactoryFinder.RENDER_KIT_FACTORY,
> 				"org.apache.myfaces.renderkit.RenderKitFactoryImpl");
> 		// **************************************************************
> 		delegate.init(servletConfig);
> 		authenticationPage = servletConfig
> 				.getInitParameter(INIT_PARAM_AUTHENTICATION_PAGE);
> 		if (authenticationPage == null) {
> 			throw new ServletException("must set '"
> 					+ INIT_PARAM_AUTHENTICATION_PAGE
> 					+ "' parameter in AeolusFacesServlet");
> 		}
> 		changePasswordPage = servletConfig
> 				.getInitParameter(INIT_PARAM_CHANGE_PASSWORD_PAGE);
> 		if (changePasswordPage == null) {
> 			throw new ServletException("must set '"
> 					+ INIT_PARAM_CHANGE_PASSWORD_PAGE
> 					+ "' parameter in AeolusFacesServlet");
> 		}
> 	}
> 	/**
> 	 * {@inheritDoc}
> 	 */
> 	public void destroy() {
> 	    if (LOGGER.isDebugEnabled()) {
>             LOGGER.debug(" Fim do servlet do MyFaces. Nome da instância: " + delegate.getServletConfig().getServletName()
>             		+ ", Configuração do Servlet: " + delegate.getServletInfo());
> 	    }
> 		delegate.destroy();
> 	}
> 	/**
> 	 * {@inheritDoc}
> 	 */
> 	public ServletConfig getServletConfig() {
> 		return delegate.getServletConfig();
> 	}
> 	/**
> 	 * {@inheritDoc}
> 	 */
> 	public String getServletInfo() {
> 		return delegate.getServletInfo();
> 	}
> 	/**
> 	 * {@inheritDoc}
> 	 */
> 	public void service(final ServletRequest request,
> 			final ServletResponse response) throws ServletException,
> 			IOException {
> 		if (isUserLogged((HttpServletRequest) request,
> 				(HttpServletResponse) response)) {
> 			delegate.service(request, response);
> 		} else {
> 				redirectToAuthenticationPage((HttpServletRequest) request,
> 						(HttpServletResponse) response);
> 		}
> 	}
> 	/**
> 	 * Checa se o usuario está logado.
> 	 * 
> 	 * @param request
> 	 *            Objeto HttpServletRequest.
> 	 * @param response
> 	 *            Objeto HttpServletResponse.
> 	 * @throws IOException
> 	 *             IOException.
> 	 * @return True caso o usuário esteja autenticado ou seja a pagina de login
> 	 *         ou troca de senha.
> 	 */
> 	protected boolean isUserLogged(final HttpServletRequest request,
> 			final HttpServletResponse response) throws IOException {
> 		// Verifica se o contexto é nulo e se nao são as paginas de login e
> 		// troca de senha
> 		if (!(request.getServletPath().equals(authenticationPage) || request
> 				.getServletPath().equals(changePasswordPage))
> 				&& AeolusSessionManager.getInstance().getDefaultAeolusSession(
> 						request.getSession(true)).getAeolusUserContext() == null) {
> 		    if (LOGGER.isDebugEnabled()) {
> 		        LOGGER.debug(" Sessão vazia. " + request.getRequestedSessionId());
> 		    }
> 			return false;
> 		}
> 		
> 		if (AeolusSessionManager.getInstance().getDefaultAeolusSession(
> 				request.getSession(true)).getAeolusUserContext() != null) {
> 		    if (LOGGER.isDebugEnabled()) {
>     			LOGGER.debug(" ID da Sessão = " + request.getRequestedSessionId()
>     					+ "Dados do Usuário: " + AeolusSessionManager.getInstance().getDefaultAeolusSession(
>     							request.getSession(true)).getAeolusUserContext().getUserName());
> 		    }
> 		} else {
> 		    if (LOGGER.isDebugEnabled()) {
> 		        LOGGER.debug(" ID da Sessão = " + request.getRequestedSessionId());
> 		    }
> 		}
> 		return true;
> 	}
> 	/**
> 	 * Direciona o sistema para a tela de autenticação.
> 	 * 
> 	 * @param request
> 	 *            Objeto HttpServletRequest.
> 	 * @param response
> 	 *            Objeto HttpServletResponse.
> 	 * @throws IOException
> 	 *             IOException.
> 	 */
> 	protected void redirectToAuthenticationPage(
> 			final HttpServletRequest request, final HttpServletResponse response)
> 			throws IOException {
> 		if (!"".equals(authenticationPage)) {
> 			response.sendRedirect(request.getContextPath() + authenticationPage);
> 		}
> 	}
> }
> ************************************
> --> Vivo360FacesServlet
> ***********************************
> /**
>  * Projeto: VIVO360
>  * Vivo360FacesServlet.java
>  * Descrição: Servlet para o projeto Vivo360 que estende o AeolusFacesServlet.
>  *
>  *@author     <a href="mailto:sdcs-d-gargaro@ptinovacao.pt">Diego S Gargaro</a>
>  *@created    14/08/2008
>  *@version    $Id: Vivo360FacesServlet.java,v 1.14 2009/04/17 17:09:02 xsdc743 Exp $
>  */
> package br.com.vivo.vivo360.ui.servlet;
> import java.io.IOException;
> import javax.servlet.ServletConfig;
> import javax.servlet.ServletException;
> import javax.servlet.ServletRequest;
> import javax.servlet.ServletResponse;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
> import org.ajax4jsf.context.AjaxContext;
> import org.apache.log4j.Level;
> import pt.ptinovacao.components.aeolus.web.servlet.AeolusFacesServlet;
> import pt.ptinovacao.components.aeolus.web.session.AeolusSession;
> import br.com.vivo.vivo360.commons.exception.Vivo360ApplicationException;
> import br.com.vivo.vivo360.commons.util.ErrorUtils;
> import br.com.vivo.vivo360.commons.util.LogUtils;
> import br.com.vivo.vivo360.commons.util.context.ContextUtils;
> import br.com.vivo.vivo360.util.constant.error.infra.ConstantsTratamentoErro;
> /**
>  * @author Diego S Gargaro
>  *
>  */
> public class Vivo360FacesServlet extends AeolusFacesServlet {
>     /**
>      * Serial.
>      */
>     private static final long serialVersionUID = 1L;
>     /**
>      * Nome do parâmetro a ser buscado no web.xml que conterá o valor da página
>      * de erro.
>      */
>     private static final String INIT_PARAM_ERROR_PAGE = "errorPage";
>     /**
>      * URL da página de erro à partir do contextPath.
>      */
>     private String errorPage;
>     /**
>      * {@inheritDoc}
>     */
>     @Override
>     public void init(
>             final ServletConfig servletConfig)
>         throws ServletException {
>         super.init(servletConfig);
>         errorPage = servletConfig.getInitParameter(INIT_PARAM_ERROR_PAGE);
>         if (errorPage == null) {
>             throw new ServletException("É necessário configurar o parâmetro '" + INIT_PARAM_ERROR_PAGE
>                     + "' no Vivo360FacesServlet");
>         }
>     }
>     /**
>      * {@inheritDoc}
>     */
>     @Override
>     public void service(
>             final ServletRequest request,
>             final ServletResponse response)
>         throws ServletException, IOException {
>         AeolusSession aeolusSession = (AeolusSession) ((HttpServletRequest) request).getSession().getAttribute(
>                 "pt.ptinovacao.components.aeolus.web.session.defaultSessionName");
>         try {
>             this.configNoCacheRespone((HttpServletResponse) response);
>             super.service(request, response);
>             //Remove o identificador de quando o sistema está posicionado na tela de erro.
>             if (((HttpServletRequest) request).getSession().getAttribute(ConstantsTratamentoErro.KEY_IS_ERROR_PAGE) != null) {
>                 //Se for a request do redirect para a tela de erro.
>                 if ((Boolean) ((HttpServletRequest) request).getSession().getAttribute(ConstantsTratamentoErro.KEY_IS_ERROR_PAGE)) {
>                     Boolean isErrorPage = Boolean.FALSE;
>                     ((HttpServletRequest) request).getSession().setAttribute(ConstantsTratamentoErro.KEY_IS_ERROR_PAGE,
>                             isErrorPage);
>                 } else {
>                     ((HttpServletRequest) request).getSession().removeAttribute(ConstantsTratamentoErro.KEY_IS_ERROR_PAGE);
>                 }
>             }
>         } catch (ServletException servletException) {
>             Boolean isAjax = false;
>             if ((AjaxContext) request.getAttribute(AjaxContext.AJAX_CONTEXT_KEY) != null) {
>                 isAjax = ((AjaxContext) request.getAttribute(AjaxContext.AJAX_CONTEXT_KEY)).isAjaxRequest();
>             }
>             this.logError(servletException.getRootCause(), (HttpServletRequest) request);
>             if (isAjax) {
>                 throw servletException;
>             } else {
>                 //Verifica se o sistema já está posicionado na tela de erro.
>                 if (isUserLogged((HttpServletRequest) request, (HttpServletResponse) response)
>                         && ((HttpServletRequest) request).getSession().getAttribute(ConstantsTratamentoErro.KEY_IS_ERROR_PAGE) == null) {
>                     //Se não estiver, manda para a tela de erro.
>                     ((HttpServletRequest) request).getSession().setAttribute(ConstantsTratamentoErro.KEY_IS_ERROR_PAGE, true);
>                     //Verifica se o erro foi tratado.
>                     if (request.getAttribute(ConstantsTratamentoErro.ERRO_TRATADO_KEY) == null) {
>                         //Se não foi, inclui esse erro no tratamento de erros.
>                         ErrorUtils.getInstance().addCommonError((HttpServletRequest) request, servletException.getRootCause(),
>                                 ConstantsTratamentoErro.ERRO_COMMON_DEFAULT_KEY);
>                     }
>                     redirectToErrorPage((HttpServletRequest) request, (HttpServletResponse) response);
>                 } else {
>                     //Se estiver, não trata a exceção.
>                     ((HttpServletRequest) request).getSession().removeAttribute(ConstantsTratamentoErro.KEY_IS_ERROR_PAGE);
>                     throw servletException;
>                 }
>             }
>         }
>     }
>     /**
>      * Direciona o sistema para a tela de erro.
>      * @param request Objeto HttpServletRequest.
>      * @param response Objeto HttpServletResponse.
>      * @throws IOException IOException.
>      */
>     protected void redirectToErrorPage(
>             final HttpServletRequest request,
>             final HttpServletResponse response)
>         throws IOException {
>         if (!"".equals(errorPage)) {
>             response.sendRedirect(request.getContextPath() + errorPage);
>         }
>     }
>     private void configNoCacheRespone(
>             HttpServletResponse response) {
>         response.setHeader("Cache-Control", "no-cache");
>         response.setHeader("Pragma", "no-cache");
>         response.setDateHeader("Expires", -1);
>     }
>     private void logError(
>             final Throwable throwable,
>             final HttpServletRequest request) {
>         
>         Throwable causeThrowable = buscaVivo360Exception(throwable);
>         
>         if (!(causeThrowable instanceof Vivo360ApplicationException)) {
>             causeThrowable = throwable;
>         }
>         boolean doLog = true;
>         if (causeThrowable instanceof Vivo360ApplicationException) {
>             if (((Vivo360ApplicationException) causeThrowable).getErroInfoBean() != null) {
>                 doLog = !((Vivo360ApplicationException) causeThrowable).getErroInfoBean().isLogged();
>             }
>         }
>         if (doLog) {
>             StringBuilder stringBuilder = new StringBuilder("Ocorreu um erro na camada de apresentação, segue detalhes:");
>             stringBuilder.append(LogUtils.getInstance().getDetalheCabecalhoUsuario(request));
>             stringBuilder.append(LogUtils.getInstance().getDetalheDaException(causeThrowable));
>             LogUtils.getInstance().logMessage(stringBuilder.toString(), Level.ERROR);
>             LogUtils.getInstance().logThrowable(causeThrowable);
>         }
>     }
>     
>     private Throwable buscaVivo360Exception(final Throwable throwable) {
>         if (throwable instanceof Vivo360ApplicationException) {
>             return throwable;
>         }
>         if (throwable.getCause() != null) {
>             return buscaVivo360Exception(throwable.getCause());
>         }
>         return throwable;
>     }
> }
> This problem is critical because this occurs in production.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.