首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >DHtmlUpdateServlet -在客户端发现错误:[接收]意外令牌< (SyntaxError)

DHtmlUpdateServlet -在客户端发现错误:[接收]意外令牌< (SyntaxError)
EN

Stack Overflow用户
提问于 2016-01-14 09:46:47
回答 1查看 518关注 0票数 2

我正在使用ZK8+SpringSecurity4+ Spring 1.3将应用程序(JDK 6、ZK6.5、SpringFramework3.2、SpringSecurity3.1)升级到JDK 8,但在成功的登录(即,如果用户名或密码不好,我没有看到此错误)上出现了以下错误:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
10:13:39.139 [http-nio-8080-exec-220] DEBUG o.z.zk.au.http.DHtmlUpdateServlet - Error found at client:
    [Receive]Unexpected token < (SyntaxError)     
    sid: 9524     
    user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
    content-length: 309
    content-type: application/x-www-form-urlencoded;charset=UTF-8
    ip: 0:0:0:0:0:0:0:1

这会导致客户端出现一个丑陋的基于ZK框架的弹出。发生此错误时呈现的页面为/secure/login.zul,但tidy报告页面中没有错误:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
tidy -xml ./src/main/webapp/secure/login.zul
No warnings or errors were found.

/secure/login.zul

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<?xml version="1.0" encoding="UTF-8"?>
<?page title="Login"?>
<?init class="com.xxxxxx.web.OnlyAnonymousInitiator"?>
<zk xmlns="http://www.zkoss.org/2005/zul" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd" xmlns:n="native" xmlns:h="http://www.w3.org/1999/xhtml"
    xmlns:w="client">
  <n:div class="container_16">
    <n:div class="grid_12">
      <idspace>
    <panel border="normal">
      <caption label="Login" />
      <panelchildren apply="com.xxxx.web.pages.login.LoginMainComposer">
        <n:div class="xxxxxx-panel-contents">
          <n:table class="xxxxxx-table-plain">
        <n:tr>
          <n:td>
            <label value="Username:" />
          </n:td>
          <n:td>
            <textbox id="username" />
          </n:td>
        </n:tr>
        <n:tr>
          <n:td>
            <label value="Password:" />
          </n:td>
          <n:td>
            <textbox id="password" type="password" />
          </n:td>
        </n:tr>
        <n:tr>
          <n:td />
          <n:td>
            <button id="login" label="Log in" image="/images/icons/door_in.png" />
          </n:td>
        </n:tr>
          </n:table>
          <button href="/" label="Cancel" image="/images/icons/cross.png" />
        </n:div>
      </panelchildren>
    </panel>
      </idspace>
    </n:div>
  </n:div>
</zk>

这个页面在最初的应用程序中运行得很好。zk.xml文件非常简单:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<?xml version="1.0" encoding="UTF-8"?>
<zk>
  <desktop-config>
    <theme-uri>/css/960.css</theme-uri>
    <theme-uri>/css/xxxxxx.css</theme-uri>
  </desktop-config>
  <system-config>
    <ui-factory-class>
      com.xxxxxx.web.XxxxxxUiFactory
    </ui-factory-class>
  </system-config>
  <device-config>
    <device-type>ajax</device-type>
    <server-push-class>
      fi.gekkio.splake.atmosphere.AtmosphereServerPush
    </server-push-class>
  </device-config>
  <library-property>
    <name>org.zkoss.theme.preferred</name>
    <value>atlantic</value>
  </library-property>
  <library-property>
    <name>org.zkoss.bind.DebuggerFactory.enable</name>
    <value>true</value>
  </library-property>
</zk>

知道这个错误的根源是什么吗?或者如何从ZK获得更多信息来调试它?或者如何解决这个问题?

审查代码ZK框架代码,我看到了:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
final String errClient = request.getHeader("ZK-Error-Report");
        if (errClient != null)
            if (log.isDebugEnabled()) 
                log.debug(
                    "Error found at client:
                        "+errClient+"\n"+Servlets.getDetail(request));

在查看响应头时,我确实看到:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
Referer:http://localhost:8080/xxxxxx/secure/login.zul
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
ZK-Error-Report:[Receive] Unexpected token < (SyntaxError)
ZK-SID:1111

以及以下响应头:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
ZK-Error:410
ZK-SID:1111

( SID与原版不同,但也是相同的错误.)在Chrome中,当错误被触发时,我看到两个请求:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
Request URL:http://localhost:8080/xxxxxx/zkau
Request Method:POST
Status Code:302 Found
Remote Address:[::1]:8080
Response Headers
view source

其次是:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
Request URL:http://localhost:8080/xxxxxx/
Request Method:GET
Status Code:200 OK
Remote Address:[::1]:8080

因此,上述302的(错误)处理似乎以某种方式触发了这条错误消息。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-04-26 04:46:07

呃-非常令人沮丧。

在花了许多小时试图在ZK中跟踪这个问题而没有找到可行的解决方案之后,我放弃了;我用Spring、Security和角2替换了ZK,现在我正在取得进展。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34796334

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文