微信公众平台修改服务器配置时token验证失败

jsp里的源码:
<%
String token = Weixin.TOKEN;
String timestamp = request.getParameter("timestamp");
String nonce = request.getParameter("nonce");

//对微信返回的数据做SHA1加密
String sign = "";
try {
    List l = new LinkedList();
    l.add(timestamp);
    l.add(nonce);
    l.add(token);
    Collections.sort(l);
    for(Object o :l ){
        sign += (String)o;
    }
} catch (Exception e) {
    e.printStackTrace();
}
sign = SHAEncript.SHA1(sign);
String signature = request.getParameter("signature");
System.out.println("系统算出的签名:"+sign);
System.out.println("微信返给的签名:"+signature);
if(sign.equals(signature)){
    System.out.println("签名验证正确,可以接入");
    String echostr = request.getParameter("echostr");
    System.out.println("微信发回的echostr:"+echostr);
    out.print(echostr);
    System.out.println("已将原数返回");
    out.close();
}
//out.print("gg");

%>

系统算出的签名和微信返回的签名是一致的,然后就一直token验证失败。求各位大神们看看哪里出了问题。
是不是我echstr原样返回的不对。该怎么返回才正确。

我的之前也是出问题,我的修改方法: 在配置的URL中 地址: http://xxxx.com/xxx.php (指定到一个默认页面上)

数据加密比较有问题,造成验证失败!