我正在使用ZK 8 + Spring Security 4 + Spring Boot 1.3将应用程序(JDK 6,ZK 6.5,Spring Framework 3.2,Spring Security 3.1)升级到JDK 8,但我在上看到以下错误成功登录(即,如果用户名或密码不正确,我没有看到此错误):
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
报告页面中没有错误:
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));
并查看响应标头,我看到:
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
以及以下响应标头:
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(错误)处理会以某种方式触发此错误消息。
答案 0 :(得分:1)
在ZK内花了很多时间试图追踪这个问题而没有找到可行的解决方案后,我放弃了;我已经用Spring Boot,Spring Security和Angular 2取代了ZK,我现在正在取得进展。