仅在特定网络浏览器中 WildFly 服务的网络应用程序上的 ViewExpiredException [英] ViewExpiredException on a WildFly-served webapp only in a particular webbrowser

查看:24
本文介绍了仅在特定网络浏览器中 WildFly 服务的网络应用程序上的 ViewExpiredException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在 Wildfly 8.1.0Final 上运行的 jsf 应用程序,并且仅在 Google Chrome 中,当我单击登录"按钮时,我收到 ViewExpiredException,在其他浏览器或 Chrome 隐身模式下,完美运行!

有人知道可能是什么吗?

20:29:18,531 INFO [stdout] (default task-49) 2014-09-16 20:29:18 ERROR context:218 - javax.faces.application.ViewExpiredException: viewId:/login.jsf- exibição de/login.jsf não pôde ser restaurada.20:29:18,532 信息 [stdout](默认任务 49)在 com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:210)20:29:18,532 在 com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) 的信息 [stdout](默认任务 49)20:29:18,532 信息 [stdout](默认任务 49)在 com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:121)20:29:18,532 信息 [stdout](默认任务 49)在 com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)20:29:18,532 信息 [stdout](默认任务 49)在 javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)20:29:18,532 信息 [stdout](默认任务 49)在 io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)20:29:18,533 信息 [stdout](默认任务 49)在 io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)20:29:18,533 信息 [stdout](默认任务 49)在 io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)20:29:18,533 信息 [stdout](默认任务 49)在 org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)20:29:18,533 信息 [stdout](默认任务 49)在 io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)20:29:18,533 在 io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) 处的信息 [stdout](默认任务 49)20:29:18,533 信息 [stdout](默认任务 49)在 io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)20:29:18,533 信息 [stdout](默认任务 49)在 io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)20:29:18,534 信息 [stdout](默认任务 49)在 io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)20:29:18,534 信息 [stdout](默认任务 49)在 io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61)20:29:18,534 信息 [stdout](默认任务 49)在 io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)20:29:18,534 信息 [stdout](默认任务 49)在 io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)20:29:18,534 信息 [stdout](默认任务 49)在 io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)20:29:18,534 信息 [stdout](默认任务 49)在 io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)20:29:18,534 信息 [stdout](默认任务 49)在 org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)20:29:18,535 信息 [stdout](默认任务 49)在 io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)20:29:18,535 信息 [stdout](默认任务 49)在 io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)20:29:18,535 信息 [stdout](默认任务 49)在 io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240)20:29:18,535 信息 [stdout](默认任务 49)在 io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)20:29:18,536 信息 [stdout](默认任务 49)在 io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73)20:29:18,536 信息 [stdout](默认任务 49)在 io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146)20:29:18,536 信息 [stdout](默认任务 49)在 io.undertow.server.Connectors.executeRootHandler(Connectors.java:177)20:29:18,536 信息 [stdout](默认任务 49)在 io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727)20:29:18,536 信息 [stdout](默认任务 49)在 java.util.concurrent.ThreadPoolExecutor.runWorker(未知来源)20:29:18,536 信息 [stdout](默认任务 49)在 java.util.concurrent.ThreadPoolExecutor$Worker.run(未知来源)20:29:18,536 信息 [stdout](默认任务 49)在 java.lang.Thread.run(未知来源)20:29:18,536 信息 [标准输出](默认任务 49)

我的 pom.xml:

<modelVersion>4.0.0</modelVersion><groupId>com.inbit</groupId><artifactId>ProjetoBase</artifactId><包装>战争</包装><version>0.0.1-SNAPSHOT</version><name>ProjetoBase</name><属性><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><jetty.version>6.1.4</jetty.version></属性><依赖管理><依赖项><依赖><groupId>javax.annotation</groupId><artifactId>jsr250-api</artifactId><version>1.0</version><范围>提供</范围></依赖><依赖><groupId>javax.faces</groupId><artifactId>javax.faces-api</artifactId><version>2.2</version><范围>提供</范围></依赖><依赖><groupId>org.jboss.spec</groupId><artifactId>jboss-javaee-6.0</artifactId><version>3.0.2.Final</version><type>pom</type><范围>导入</范围></依赖></依赖项></dependencyManagement><依赖项><依赖><groupId>org.hibernate.javax.persistence</groupId><artifactId>hibernate-jpa-2.0-api</artifactId><范围>提供</范围></依赖><依赖><groupId>javax.enterprise</groupId><artifactId>cdi-api</artifactId><范围>提供</范围></依赖><依赖><groupId>javax.annotation</groupId><artifactId>jsr250-api</artifactId><范围>提供</范围></依赖><依赖><groupId>org.jboss.spec.javax.ejb</groupId><artifactId>jboss-ejb-api_3.1_spec</artifactId><范围>提供</范围></依赖><依赖><groupId>javax.faces</groupId><artifactId>javax.faces-api</artifactId><范围>提供</范围></依赖><依赖><groupId>org.jboss.spec.javax.servlet</groupId><artifactId>jboss-servlet-api_3.0_spec</artifactId><范围>提供</范围></依赖><依赖><groupId>org.hibernate</groupId><artifactId>hibernate-validator</artifactId><version>4.0.0.GA</version><scope>编译</scope></依赖><依赖><groupId>org.hibernate</groupId><artifactId>hibernate-entitymanager</artifactId><version>4.3.6.Final</version></依赖><!-- JPA 持久化依赖--><依赖><groupId>hsqldb</groupId><artifactId>hsqldb</artifactId><version>1.8.0.10</version></依赖><依赖><groupId>postgresql</groupId><artifactId>postgresql</artifactId><version>9.1-901-1.jdbc4</version></依赖><依赖><groupId>org.primefaces</groupId><artifactId>primefaces</artifactId><version>5.0</version></依赖><依赖><groupId>junit</groupId><artifactId>junit</artifactId><version>4.6</version></依赖><依赖><groupId>org.mockito</groupId><artifactId>mockito-all</artifactId><version>1.9.5</version></依赖><依赖><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.17</version></依赖><依赖><groupId>org.glassfish.web</groupId><artifactId>el-impl</artifactId><version>2.2</version></依赖><依赖><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId><version>1.5.6</version></依赖></依赖项><存储库><!-- 用于 Java EE 6 的 JBoss Repository --><存储库><id>repository.jboss.org</id><name>JBoss Repository</name><url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url></repository><存储库><id>prime-repo</id><name>PrimeFaces Maven 存储库</name><url>http://repository.primefaces.org</url><layout>默认</layout></repository></repositories><构建><finalName>ProjetoBase</finalName><插件><!-- 方便在 Eclipse 中下载源代码和 javadoc --><插件><groupId>org.apache.maven.plugins</groupId><artifactId>maven-eclipse-plugin</artifactId><version>2.8</version><配置><wtpversion>2.0</wtpversion><down​​loadSources>true</downloadSources><down​​loadJavadocs>true</downloadJavadocs></配置></插件><!-- 通过 maven 运行和测试的插件 --><插件><groupId>org.mortbay.jetty</groupId><artifactId>maven-jetty-plugin</artifactId><version>6.1.25</version><配置><scanIntervalSeconds>3</scanIntervalSeconds></配置></插件><!-- 确保我们在 1.7 级别编译--><插件><artifactId>maven-compiler-plugin</artifactId><version>3.0</version><配置><source>1.7</source><目标>1.7</目标></配置></插件></插件></build>

还有我的登录页面:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"xmlns:ui="http://java.sun.com/jsf/facelets"xmlns:h="http://java.sun.com/jsf/html"xmlns:f="http://java.sun.com/jsf/core"xmlns:p="http://primefaces.org/ui"><ui:composition template="/resources/template/principalAcesso.xhtml"><ui:define name="conteudo"><div id="登录"><h2><span class="fontawesome-lock"></span>ProjetoBase<h:form id="formLogin"><h:panelGroup id="painelLogin" styleClass="loading"><div id="字段集"><p:focus context="formLogin"/><p><label for="input_login">登录</label></p><p><p:inputText styleClass="input" id="input_login"value="#{loginBack.login}"/></p><p><label for="senha">Senha</label></p><p><p:password id="senha" required="true" styleClass="input"requiredMessage="A senha não pode ser em branco."value="#{loginBack.senha}"/></p><p style="text-align: center;"><p:commandButton process="@form" value="Entrar"action="#{loginBack.login()}" styleClass="botaoLogin"更新=:咆哮,formLogin"id=btnEntrar"/></p>

</h:panelGroup><p:blockUI block="painelLogin" trigger="btnEntrar">Realizando 登录...<br/><img src="resources/images/ajax.gif"/></p:blockUI></h:form>

</ui:define>

有人可以帮助我吗?

感谢您的帮助!

解决方案

WildFly 在其当前版本 8.1 中存在(会话)cookie 的问题,尤其是那些源自未知"服务器的 cookie.您可能已经知道 cookie 是特定于域的,并且每次都由浏览器发送回服务器.如果您之前在由不同服务器(例如 Tomcat、JBoss、GlassFish 等)提供服务的完全相同的域上使用相同的浏览器,并且有问题的 cookie 恰好是 JSESSIONID cookie,则 WildFly 将无法正确创建 HTTP 会话.

如果您在打开 web 应用程序之前删除所有特定于域的 (localhost) cookie,它将起作用.或者,正如您正确观察到的,如果您打开一个隐身窗口(它基本上以清晰干净的状态开始),或者当 cookie 已经过期很长时间(那些其他浏览器很少使用,对吗?).作为一种不需要在浏览器的 cookie 存储中摆弄的临时解决方法,您还可以创建一个 servlet 过滤器来检查重复的请求 cookie 并将其删除.

顺便说一下,WildFly 还存在会话 cookie 的另一个问题.当它第一次创建会话 cookie 时,它​​不使用 / 路径,而是使用一个空字符串作为路径(它基本上转换为当前文件夹而不是根文件夹).这导致当您第一次通过请求文件夹路径访问 web 应用程序时,父/根文件夹将不会共享相同的会话.这部分又可以通过 web.xml 中的以下设置来解决:

<cookie-config><路径>/</路径></cookie-config></session-config>

另见:

I have a jsf application running on Wildfly 8.1.0Final and, ONLY in Google Chrome, when I click on the Login button, i receive ViewExpiredException, in others browsers, or in Chrome Incognito Mode, works perfectly!

Someone knows what could be?

20:29:18,531 INFO  [stdout] (default task-49) 2014-09-16 20:29:18 ERROR context:218 - javax.faces.application.ViewExpiredException: viewId:/login.jsf - A exibição de /login.jsf não pôde ser restaurada.
20:29:18,532 INFO  [stdout] (default task-49)   at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:210)
20:29:18,532 INFO  [stdout] (default task-49)   at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
20:29:18,532 INFO  [stdout] (default task-49)   at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:121)
20:29:18,532 INFO  [stdout] (default task-49)   at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
20:29:18,532 INFO  [stdout] (default task-49)   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
20:29:18,532 INFO  [stdout] (default task-49)   at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
20:29:18,533 INFO  [stdout] (default task-49)   at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
20:29:18,533 INFO  [stdout] (default task-49)   at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
20:29:18,533 INFO  [stdout] (default task-49)   at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
20:29:18,533 INFO  [stdout] (default task-49)   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
20:29:18,533 INFO  [stdout] (default task-49)   at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113)
20:29:18,533 INFO  [stdout] (default task-49)   at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)
20:29:18,533 INFO  [stdout] (default task-49)   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
20:29:18,534 INFO  [stdout] (default task-49)   at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
20:29:18,534 INFO  [stdout] (default task-49)   at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61)
20:29:18,534 INFO  [stdout] (default task-49)   at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
20:29:18,534 INFO  [stdout] (default task-49)   at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
20:29:18,534 INFO  [stdout] (default task-49)   at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
20:29:18,534 INFO  [stdout] (default task-49)   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
20:29:18,534 INFO  [stdout] (default task-49)   at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
20:29:18,535 INFO  [stdout] (default task-49)   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
20:29:18,535 INFO  [stdout] (default task-49)   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
20:29:18,535 INFO  [stdout] (default task-49)   at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240)
20:29:18,535 INFO  [stdout] (default task-49)   at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
20:29:18,536 INFO  [stdout] (default task-49)   at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73)
20:29:18,536 INFO  [stdout] (default task-49)   at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146)
20:29:18,536 INFO  [stdout] (default task-49)   at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177)
20:29:18,536 INFO  [stdout] (default task-49)   at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727)
20:29:18,536 INFO  [stdout] (default task-49)   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
20:29:18,536 INFO  [stdout] (default task-49)   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
20:29:18,536 INFO  [stdout] (default task-49)   at java.lang.Thread.run(Unknown Source)
20:29:18,536 INFO  [stdout] (default task-49) 

My pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.inbit</groupId>
<artifactId>ProjetoBase</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>ProjetoBase</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <jetty.version>6.1.4</jetty.version>
</properties>


<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>jsr250-api</artifactId>
            <version>1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>javax.faces-api</artifactId>
            <version>2.2</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.spec</groupId>
            <artifactId>jboss-javaee-6.0</artifactId>
            <version>3.0.2.Final</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>



<dependencies>

    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.0-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.annotation</groupId>
        <artifactId>jsr250-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.spec.javax.ejb</groupId>
        <artifactId>jboss-ejb-api_3.1_spec</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.faces</groupId>
        <artifactId>javax.faces-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.spec.javax.servlet</groupId>
        <artifactId>jboss-servlet-api_3.0_spec</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.0.0.GA</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.3.6.Final</version>
    </dependency>

    <!-- JPA Persistence Dependencies -->

    <dependency>
        <groupId>hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <version>1.8.0.10</version>
    </dependency>

    <dependency>
        <groupId>postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.1-901-1.jdbc4</version>
    </dependency>

    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>5.0</version>
    </dependency>


    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.6</version>
    </dependency>

    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.9.5</version>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

    <dependency>
        <groupId>org.glassfish.web</groupId>
        <artifactId>el-impl</artifactId>
        <version>2.2</version>
    </dependency>


    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.5.6</version>
    </dependency>


</dependencies>



<repositories>
    <!-- JBoss Repository used for Java EE 6 pieces -->
    <repository>
        <id>repository.jboss.org</id>
        <name>JBoss Repository</name>
        <url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
    </repository>

    <repository>
        <id>prime-repo</id>
        <name>PrimeFaces Maven Repository</name>
        <url>http://repository.primefaces.org</url>
        <layout>default</layout>
    </repository>

</repositories>


<build>
    <finalName>ProjetoBase</finalName>
    <plugins>

        <!-- Facilitates downloading source and javadoc in Eclipse -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.8</version>
            <configuration>
                <wtpversion>2.0</wtpversion>
                <downloadSources>true</downloadSources>
                <downloadJavadocs>true</downloadJavadocs>
            </configuration>
        </plugin>

        <!-- Plugin to run and test through maven -->
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>6.1.25</version>
            <configuration>
                <scanIntervalSeconds>3</scanIntervalSeconds>
            </configuration>
        </plugin>

        <!-- Ensures we are compiling at 1.7 level -->
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.0</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>


    </plugins>
</build>

And my Login page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="/resources/template/principalAcesso.xhtml">
<ui:define name="conteudo">

    <div id="login">

        <h2>
            <span class="fontawesome-lock"></span>ProjetoBase

        </h2>

        <h:form id="formLogin">
            <h:panelGroup id="painelLogin" styleClass="loading">
                <div id="fieldset">
                    <p:focus context="formLogin" />
                    <p>
                        <label for="input_login">Login</label>
                    </p>
                    <p>
                        <p:inputText styleClass="input" id="input_login"
                            value="#{loginBack.login}" />
                    </p>
                    <p>
                        <label for="senha">Senha</label>
                    </p>
                    <p>
                        <p:password id="senha" required="true" styleClass="input"
                            requiredMessage="A senha não pode ser em branco."
                            value="#{loginBack.senha}" />
                    </p>
                    <p style="text-align: center;">
                        <p:commandButton process="@form" value="Entrar"
                            action="#{loginBack.login()}" styleClass="botaoLogin"
                            update=":growl, formLogin" id="btnEntrar" />

                    </p>

                </div>
            </h:panelGroup>
            <p:blockUI block="painelLogin" trigger="btnEntrar">  
                        Realizando login...<br />
                <img src="resources/images/ajax.gif" />
            </p:blockUI>
        </h:form>
    </div>

</ui:define>

Someone could help me?

Thanks for any help!

解决方案

WildFly in its current version 8.1 has trouble with (session) cookies, particularly those originating from "unknown" servers. You probably already know that cookies are domain specific and are everytime sent back to the server by the browser. If you've previously used the same browser on exactly the same domain which is served by a different server (e.g. Tomcat, JBoss, GlassFish, etc), and the cookie in question happens to be the JSESSIONID cookie, then WildFly will be unable to properly create the HTTP session.

It'll work if you trash all domain-specific (localhost) cookies before opening the webapp. Or, as you correctly observed, if you open an Incognito window (which basically starts with a crisp and clean state), or when the cookies are already expired for long (those other browsers are very rarely used, right?). As a temporary workaround without needing to fiddle around in browser's cookie store, you could also create a servlet filter which checks for duplicate request cookies and trash them.

WildFly has another problem with session cookies, by the way. When it creates the session cookie for the first time, it doesn't use the / path, but an empty string as path (which basically translates to the current folder instead of the root folder). This has the consequence that when you visit the webapp for the first time by requesting a folder path, then the parent/root folder(s) wouldn't share the same session. This part is in turn workaroundable with the following setting in web.xml:

<session-config>
    <cookie-config>
        <path>/</path>
    </cookie-config>
</session-config>

See also:

这篇关于仅在特定网络浏览器中 WildFly 服务的网络应用程序上的 ViewExpiredException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
其他开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆