本文共 2327 字,大约阅读时间需要 7 分钟。
配置好Sync4j服务器后,我在Nokia手机上设置好同步,准备和这个远端服务器进行联系人的同步。
下面的日志记录了两次失败的过程:
由于Sync4j对设备要求事先在管理控制台上配置好,并添加规则,才能够让手机登录。所以第一次尝试遭遇到了下面的失败提示:
[Sep 17, 2005 2:13:16 PM] INFO: Handling incoming request /sync4j/sync.
[Sep 17, 2005 2:13:16 PM][sync4j.handler] WARNING: Client device 'IMEI:354488006208691' not found. Authentication may fail.
[Sep 17, 2005 2:13:17 PM][sync4j]
SEVERE: Error reading principal: sync4j.framework.server.store.NotFoundException: Principal not found for IMEI:354488006208691/guest
[Sep 17, 2005 2:13:17 PM] INFO: Authentication failed for device IMEI:354488006208691. Make sure that the client used correct username and password and that there is a principal associating the user to the device.
这时候手机上提示“无效的用户名密码”。
说明手机的设备IMEI在系统中没有定义。
添加了Device,添加了该IMEI Device+User的Principal之后,重新来过。
[Sep 17, 2005 2:19:05 PM] INFO: Handling incoming request /sync4j/sync.
[Sep 17, 2005 2:19:13 PM] INFO: guest/IMEI:354488006208691 logged in.
这时候手机上提示“无法打开数据库”。
打开所有的日志,可以看到:
“
[Sep 17, 2005 3:06:09 PM]
[sync4j.engine]
FINEST:
Checking if the database
sync4j.framework.database.Database@1d349e2[name=./scal,type=<null>,statusCode=200,target=sync4j.framework.core.Target@97d3f0,source=sync4j.framework.core.Source@1db6942,anchor=sync4j.framework.core.Anchor@1db9f45,principal=IMEI:353388006208690/guest] is in the server database list.
[Sep 17, 2005 3:06:09 PM][sync4j.engine] FINEST: Not found sir”
而使用Sync4j所带的gui client得到的成功登录日志是:
“[Sep 17, 2005 3:13:08 PM] INFO: guest/syncml-phone logged in.
[Sep 17, 2005 3:13:08 PM][sync4j.handler] FINEST: moving to state STATE_PKG1_RECEIVING
[Sep 17, 2005 3:13:08 PM][sync4j.handler] FINEST: Processing the initialization commands
[Sep 17, 2005 3:13:08 PM][sync4j.engine] FINEST: Checking if the database
sync4j.framework.database.Database@1a32ea4[name=scal,type=<null>,statusCode=200,target=sync4j.framework.core.Target@4b12d9,source=sync4j.framework.core.Source@c28cb7,anchor=sync4j.framework.core.Anchor@a45435,principal=syncml-phone/guest] is in the server database list.
[Sep 17, 2005 3:13:08 PM][sync4j.engine] FINEST: Yes sir!”
也就是说,Nokia手机登录sync4j总是设置数据库为“./scal”,而原本应该为“scal”。
在手机端配置参数时,确实有一个数据库名要求配置,但明明写的是“scal”,不知道为什么传过来请求时多了一个“./”,造成接下来“Not found sir”错误,所以手机上提示“无法打开数据库”。
看了别家的应用,估计应该是这样: 在"远程数据库"输入"./contact",而不是像我开始输入的“scard”,这样就可以了。
郑昀@ultrapower 2005-9-19
转载地址:http://pmdxx.baihongyu.com/