DHtmlUpdateServlet - 在客户端发现错误:[接收] 意外令牌 < (SyntaxError)
DHtmlUpdateServlet - Error found at client: [Receive] Unexpected token < (SyntaxError)
我正在将应用程序(JDK 6、ZK 6.5、Spring Framework 3.2、Spring Security 3.1)升级到 JDK 8 和 ZK 8 + Spring Security 4 + Spring Boot 1.3 但我在 successful sign-in 上看到以下错误(即,如果用户名或密码错误,我没有看到这个错误):
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 framework-based pop-up。发生此错误时呈现的页面是 /secure/login.zul
但 tidy
报告页面中没有错误:
tidy -xml ./src/main/webapp/secure/login.zul
No warnings or errors were found.
/secure/login.zul:
<?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
文件非常简单:
<?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获取更多信息来调试呢?或者怎么解决?
Reviewing code ZK framework code,我看到了:
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));
查看回复 headers,我确实看到了:
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
和以下响应 headers:
ZK-Error:410
ZK-SID:1111
(SID和原来的不一样,但是一样的错误...)在Chrome中,触发错误的时候看到两个请求:
Request URL:http://localhost:8080/xxxxxx/zkau
Request Method:POST
Status Code:302 Found
Remote Address:[::1]:8080
Response Headers
view source
其次是:
Request URL:http://localhost:8080/xxxxxx/
Request Method:GET
Status Code:200 OK
Remote Address:[::1]:8080
所以看起来很可能,上面 302 的(错误)处理以某种方式触发了这个错误消息。
呃 - 非常令人沮丧。
在花了很多时间试图在 ZK 中追踪这个问题但没有找到可行的解决方案之后,我放弃了;我已经用 Spring 引导、Spring 安全和 Angular 2 替换了 ZK,现在我正在取得进展。
我正在将应用程序(JDK 6、ZK 6.5、Spring Framework 3.2、Spring Security 3.1)升级到 JDK 8 和 ZK 8 + Spring Security 4 + Spring Boot 1.3 但我在 successful sign-in 上看到以下错误(即,如果用户名或密码错误,我没有看到这个错误):
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 framework-based pop-up。发生此错误时呈现的页面是 /secure/login.zul
但 tidy
报告页面中没有错误:
tidy -xml ./src/main/webapp/secure/login.zul
No warnings or errors were found.
/secure/login.zul:
<?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
文件非常简单:
<?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获取更多信息来调试呢?或者怎么解决?
Reviewing code ZK framework code,我看到了:
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));
查看回复 headers,我确实看到了:
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
和以下响应 headers:
ZK-Error:410
ZK-SID:1111
(SID和原来的不一样,但是一样的错误...)在Chrome中,触发错误的时候看到两个请求:
Request URL:http://localhost:8080/xxxxxx/zkau
Request Method:POST
Status Code:302 Found
Remote Address:[::1]:8080
Response Headers
view source
其次是:
Request URL:http://localhost:8080/xxxxxx/
Request Method:GET
Status Code:200 OK
Remote Address:[::1]:8080
所以看起来很可能,上面 302 的(错误)处理以某种方式触发了这个错误消息。
呃 - 非常令人沮丧。
在花了很多时间试图在 ZK 中追踪这个问题但没有找到可行的解决方案之后,我放弃了;我已经用 Spring 引导、Spring 安全和 Angular 2 替换了 ZK,现在我正在取得进展。