Wildfly8.1.0部署jsf2.2 - cookie名称是一个保留令牌

时间:2014-09-17 03:47:02

标签: jsf-2.2 wildfly-8

我尝试使用wildfly 8.1.0来部署jsf2.2 我正在部署一个由Netbeans7.4生成的简单Helloworld,同时我创建了一个新的JSF项目,但每当我访问http://localhost:8080/Helloworld/时,它都会告诉我

  

java.lang.IllegalArgumentException:Cookie名称" tocTree_ref-topic-group:ref-group-applications:ref-appeditText-hi"是保留令牌

在我在wildfly8.1.0中部署jsf之前,我需要配置一些东西吗? 这是我完整的堆栈跟踪:

11:27:17,978 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "Helloworld.war" (runtime-name: "Helloworld.war")
11:27:18,500 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-7) 正在初始化環境「/Helloworld」的 Mojarra 2.2.6-jbossorg-4 20140501-1134
11:27:19,477 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) JBAS017534: Registered web context: /Helloworld
11:27:19,530 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018559: Deployed "Helloworld.war" (runtime-name : "Helloworld.war")
11:27:38,347 FATAL [javax.enterprise.resource.webcontainer.jsf.context] (default task-1) JSF1073:在 RESTORE_VIEW 1 的處理期間截獲 java.lang.IllegalArgumentException:UIComponent-ClientId=,訊息=Cookie name "tocTree_ref-topic-group:ref-group-applications:ref-appeditText-hi" is a reserved token
11:27:38,362 FATAL [javax.enterprise.resource.webcontainer.jsf.context] (default task-1) Cookie name "tocTree_ref-topic-group:ref-group-applications:ref-appeditText-hi" is a reserved token: java.lang.IllegalArgumentException: Cookie name "tocTree_ref-topic-group:ref-group-applications:ref-appeditText-hi" is a reserved token
    at javax.servlet.http.Cookie.<init>(Cookie.java:192) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
    at io.undertow.servlet.spec.HttpServletRequestImpl.getCookies(HttpServletRequestImpl.java:145) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at com.sun.faces.context.RequestCookieMap.get(RequestCookieMap.java:79) [jsf-impl-2.2.6-jbossorg-4.jar:]
    at java.util.Collections$UnmodifiableMap.get(Collections.java:1339) [rt.jar:1.7.0_40]
    at com.sun.faces.context.flash.ELFlash.getCookie(ELFlash.java:956) [jsf-impl-2.2.6-jbossorg-4.jar:]
    at com.sun.faces.context.flash.ELFlash.doPrePhaseActions(ELFlash.java:581) [jsf-impl-2.2.6-jbossorg-4.jar:]
    at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:215) [jsf-impl-2.2.6-jbossorg-4.jar:]
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99) [jsf-impl-2.2.6-jbossorg-4.jar:]
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:121) [jsf-impl-2.2.6-jbossorg-4.jar:]
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) [jsf-impl-2.2.6-jbossorg-4.jar:]
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) [jboss-jsf-api_2.2_spec-2.2.6.jar:2.2.6]
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]

    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_40]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_40]
    at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_40]

P.S。
我正在使用Netbeans7.4创建jsf项目,只需将.war复制到成功部署项目的wildfly-8.1.0.Final\standalone\deployments即可。我访问网址后显示错误。

2 个答案:

答案 0 :(得分:1)

答案在Cookie javadoc中。来自constructor(链接我的):

  

名称必须符合RFC 2109。但是,供应商可能会提供一个配置选项,允许接受符合原始Netscape Cookie Specification的cookie名称。

来自setValue() method,对于允许的字符更具描述性:

  

对于版本0的cookie,值不应包含空格,括号,括号,等号,逗号,双引号,斜杠,问号,符号,冒号和分号。空值在所有浏览器上的行为可能不同。

在您的特定情况下,冒号会造成麻烦。一种方法确实忽略了RFC2109的强制执行。但是,您应该了解MSIE浏览器目前不支持此功能。它将返回带引号的cookie值,并将它们视为会话cookie。另请参阅Why do cookie values with whitespace arrive at the client side with quotes?

答案 1 :(得分:0)

根据this page我用谷歌搜索,我添加了一个系统属性,它可以工作:

  

org.glassfish.web.rfc2109_cookie_names_enforced =假

但是,我不知道这确实是一个解决方案,还是只是一种解决方法。

只需为将来需要的人留下链接和属性名称。