openfire服务器报错,登录时绑定资源找不到session

错误日志

2014.09.29 17:41:19 org.jivesoftware.openfire.handler.IQBindHandler - Error during resource binding. Session not found in [2cd45a5f, d546b357, 823c9ca1, d3d5c69c, 19ea6814, ae28c8d2, 6bf95251, 22a4c97, 93ea2ce1, 37f01180, f709672e, 178dd63, 45b8e5da, d9285aa4, 14b31887, 41d08eac, b5706f7, 69840aa9, 18f9fce1, 3c4a5c93, 6f1c23b4, 3308e6bc, b348741e, 721bb186, cf28cb1d, bd9260e1, ce6e44ab, ab4f6679, ae060013, 7dfa12c3, 8efa3923, ed9a0d20, 13979012, 5a45a985, 2c70cb91, 46465925, 20d63af0, 26a5864a, 93a9d7f0, 23d48b3e, 540327cd, fb3820b6, f98e6c09, ba785e5d, 16eef3a8, 779a42a3, 45215f00, 1a95af70, baf3b781, 354d6dda, 3f431aa7, 5da71f84, c20cd40b, cf126b9e, 609889b3, fdfdc998, d06fc6a8, 21ca19d3, 8aaa8a24, 2b3cedc3, 3d83aae, 2b94988b, cff54e3c, a0c8b605, 31ba37bf, 4aa48789, 332777a7, 95828b99, 30457f17, 612fb98c, 304b87b4, 7171fefc, ac6512ed, 4483adf2, 372abbc5, 4283ced5, 6af34e16, bb1a4caa, a0210a5, 2d011ba, e24942ad, eb90d304, c11ec56a, 3b972f32, 4906811e, c7e269e8, 43ee07f1, 49842cfc, d5028cd5, eb796ec8, d73b6ee9, 9004b35b, 8bd57a0b, 99d53f2b, 33a989c0, 4917f4a5, fbdda855, b26e95ad, ab7a9bb5, 662ef7cf, 43d3e6c9, f00b9ffc, 51f3e298, 4b159ac9, b3e1bf95, 4d67cf8, f982a2c3, f8d4bfa9, f6b77f49, 497668ad, 36da741, eb2769cd, 7675fe7f, fd168395, 33026e42, 6b07bfb7, d171fbb, c34a1b84, 3b6bb8a8, 8d6425cd, 211117c4, c086db1, 119643a, 255a0421, 2033c3c, 164f6abe, 77530d01, fa44ed9a, d24a9dc8, dbf9f581, 8b4dda73, ce4e251f, 82a59aff, e9ece3c, 36070491, bb0ea492, 8282e477, 85ec487b, c7362f3d, 32bcf325, d57e3814, e179a3b7, 9f653115, 59bdcbda, 65585053, 29c91cef, 2f3c36a0, cb00ae5c, 3aeb6859, 57b9a7b5, 9461a6bf, 150bb2e4, 49275b45, 4667deff, 1967d335, c36e5b89, 31585e4a, 5bd36977, 7d052e9a, 3c03a06e, eb1a51c5, c5279398, 52a741c0, f732e503, 41ddd452, 5325baf4, 66e2a163, d6b0693c, 2403e72d, fa7e75dc, 173e883, 5ad60d24, 9cac7e, 176f7c5e, 2fce8174, a5ac431e, 85b61ca1, b0237d58, b4d42f38, c4b3da87, 9fa4284e, 9b04d382, 8b016fb0, 30ca8a2c, c4f154c7, abb75df2, 7e55bad4, ffe72461, d956d15f, 45f39a88, f815f546, c15e47c4, 790ad9c7, 54a9cec4, 823f6e8, 14c936eb, f0113507, 2635a370, 4a66c323, d26a49cd, 9e0cf992, b09af672, 51e93cf5, c694739a, 4308f4d9, eaf8650, 81c320c6, 8dc838c8, 53b0f72f, ceab17e0, 34ed39e5, e1e6bb25, 799f737b, 6cc5c14, d4997331, ff3f68, 7f6f1ed2, 3750dbf2, 4933597, 2309f055, 932c4a2e, 4a7293c9, 3fa021ad, bb9d1530, 5a4b0c66, b19ee9a5, a6f30b8b, f2465d3b, 2468dda8, 68121ed7, 70f53a7f, 3afad471, d24190, 15735842, fefa024f, 1f6ea5cf, 736dac7, 919a51, 558bd046, d4a71e7f, 34decf4d, ed97a6f8, 2c21d1d2, 60aab431, e08d01b3, 6a49c1e4, 6bb3ef86, e1e22bd8, a7c269e6, 8d1363a3, a8249852, 7a89d63b, feaba431, 5566415a, dd51ca17, 726cca99, 6dc231c2, 7f63b7bd, 3692dd45, 24982fd, 6fb0592b, 64120340, e4eb5bb, c3aed7c9, 4a4e81ed, feedc0b8, ed719624, f482c5b7, ca67786d, 58727f44, 816aa0a0, d14c0c25, f7e3a7b0, 4fbdf179, 53b46ef5, 5f9ff9e6, 4d5cb9aa, e46fb6f5, b8a88a90, 4363153, 2a4129c9, 7ac047ac, c33cbb69, fd560c59, f88f4306, 23555c61, c1c27f6b, 7adf84dd, d5b507bd, 35e4776e, a3cc0087, e01740a9, 837cb67a, 8b04d1e1, ee527ec0, 53c11405, c7654ff6, dbf6442, fab15c93, 63910fb7, a99fef05, 6d622e94, 3a1ed7e, 95452ad1, 84a6bda2, d440edaf, c1b0e783, f6bb425b, 48dbe530, 23523c1c, 26882234, b092f126, 1d1bb2ef, e54d87b9, 6cc1a1c, 9d98326d, ecaebfb2, b0cb0b30, a97954cf, 91bcdcf, 5f37a446, f4702206, 62d2f297, 19df821f, 5f46e341, 87496320, 65af407a, d20a132d, 9c061cd3, 83d5d5e2, fef3cccf, bd03c55, 533fd87d, d3df16d6, d8642182, c1660389, 3632da9b, 83994095, 435aa933, 84604b0e, c5ec3ea0, c39a818e, c6053d58, 2944d0d, 4a841fdd, 9b12d93e, 8b217b5e, dc5982be, ac34ab84, e5fa8c81, aea473bc, ad278bd8, e992f541, 3be9f357, ee24808, 12d2df08, 286aa186, be903c6b, 8e54562c, 4c8e5ce8, 59ab6bf7, 76c9a51b, 86a74e2b, c979626b, 2cd5c8dd, c0e3f867, 72285653, 8587c115, bab18a64, efee542b, 20c6afac, 3f124faa, aa31a85, b6db091c, 26deef83, c674fe3c, 1eb71ccc, 5009bc2c, 470fc8bd, 41780e2a, 7f530735, d9ea4181, a0956579, 1eee00f4, e1e2f2cc, cb454634, 2942e7a5, a3911b97, de1e220a, dffb0dff, f512f834, acbe445b, f111cef0, 4451ac49, bc0ffba2, 866f63d1, 3ec8532e, f8ca8ef8, 58c34b9, b25e7396, 246f528a, 746c61a1, 9230ca25, 60999471, 4794a75e, 3ed3f3e, 67aa1628, 4ca9ade6, 4c38b344, 8dfedc18, ed197915, b4cfadc0, b8aadac8, ed46cf3b, 2bb2306d, 33d0e4c6, 2fcaf32f, 5ed7af07, b4af569, 6f90b046, 9a6e57b3, ddad8b6, b71ea081, 4e3fef1a, afdd4cff, 4abe411a, 39c462f9, dbd35c8c, 87abb424, b0ca963b, 51ad1d1f, d219cd94, ff89e20f, 397259bd, 588b3bef, e7e75a01, c5fb6d77, 22ba73f1, 4b7b0e98, 976bd57e, 46bbdd10, fe28df90, 7c08a6ef, 90939cff, f98c7842, d12e516e, aff80a30, 47c34b38, 77a470e7, f95791e8, 83dfcdc1, de5f4b4c, 58a216ff, c357f073, 326a2360, d2dcd75, 4495ac61, 26422f5e, f39a7186, e94e585f, 97fef3ad, 4c324bb3, 6988409b, e08f3247, 3455f746, d8dada4a, ecacd5a9, 4cfffd46, 750697d9, 4735639, 17397ea4, 9b4d9b46, eb5b739, 92840c82, 3a290ac8, bf53f63c, f4beaf33, d4fddcd6, e506c31d, 763be4f0, 6fd6dfae, 404af8ee, 392be4e1, 54c2b2b, 30a3fdaf, 1a8971c0, 63f94d95, faf9a11c, e1efe9f0, 74725eb9, c85e2408, 644de27b, a3b277e2, 6f023558, 5007e9b7, c197391d, ad12e03, aadf20b5, aff41941, 7267f545, 41e4d56b, bc0966c7, f88c47b0, 68d3b8c4, 59ef0f5b, 390569c9, 85c571dc, 820fd946, f9ed8f20, c842492b, 50f18b01, 3ad77cdb, 4cd2771d, c4c1613b, 4c1b3121, d1332605, a97e235c, 1b2cebb5, aedc389d, 3301546a, c4642d90, 32fc597, 54c72ce, 969603f9, ff0cb530, a4b6e08a, 2c9afe0c, c7aceed1, b1a3a423, bb460e98, faca6c93, fe433bdd, 4c7270b9, 786083f7, 696a35f2, 16f33487, d6150abf, 506c3049, b419569, 3199e2e0, 5c7f0149, 6e9e169a, 7e147ec3, 27748a54, 896661f8, b160ef11, e122b1e6, 7625c05a, d17e9c30, 498284dc, 87245af4, a0eb86fd, 149ebbb4, 28405eda, bf065158, 286e43d7, 8434cbb, 5f4e6d18, 7e5a0ec1, 29e2727d, 8f778a98, b70e704e, 5daa1b8e, 5700d52b, b2a98050, 96dec257, f469279c, aaebf6c9, 97f1dbce, 7c077985, 1dfd41af, d1ca6500, 8d238ef, 2655791e, e700ff84, e382c221, 34f10f41, cc49bb76, dd7a781f, 8ead81fe, 35aaf4b8, 986a093d, 77475826, 237cda16, a84d7588, 681d9836, 2f6d720f, fae07989, aba29b0e, d393d0ca, dca23df6, fc2b86e8, e7ef6388, 4b868419, 19f6361d, b930efe5, 2b602ed0, 740fc4fb, 86a79e77, 35502ddd, 33af6bab, 3fb43053, dabf1ca8, b8ff3545, 774c1cb2, f0c11baa, 9afffc9a, c674892b, 80a7a3, 743ef, b399c1a, d7619a60, 34f5bb3, f0b1d881, 74f3d584, 6f358fd5, 146f182d, 9746ba69, 116a05d4, 634f0257, e40da3ba, 4d4ff6ab, c1d7d767, 81650f8a, db50c38e, 78cbb443, 6eff4db9, f892fd3e, a27211ac, 7cb10066, 5c017c3c, 6b2453f7, 4f5a2577, 7ceb66f8, 7dd13427, 8258c099, 20bfec28, 3d4ba01, a033fb05, f1bb837a, 22e09a6b, 756be172, af1811cb, d0a1430d, f777b8b7, 73e3331, 9ffdb1cb, 1daf46e1, 59fcbd1f, 5be5e4c5, 5977ea41, dc086c2d, 74c17c22, 8b0c31e8, 3b14e207, 813c5bb1, b0b67e81, cb75b774, 72295ac6, 97b4c5a7, aa62963, 9e407d38, eb799840, fa207a9, 720c65a7, edbe17cc, 5b4555cd, 7b81dc37, 51197c9e, 5b4927b3, 6a5ba0a2, 33d3ee8d, 8137a4d9, 83d2c019, 6baa9ccc, 6dcb3d5d, 9777fa55, 1ff08c1, ed318a40, 437a1f86, e7f50ce1, 5c0fe84b, 93b60fae, 82587fc3, 4b891034, 6fc6f7ee, 91381f52, 6116e3f4, fc7cda4a, 145ea0a7, e9d3117f, 35fc7a9e, 451952d7, a9d690a7, da605d2a, d60efa9c, ce3677bf, 209d11bb, edf7a5dd, aca920eb, 8f731d8d, 95a59f48, 13aefbbf, 431303bd, c591b584, ef403d29, 3920424b, 4e51707a] for key [email protected]/Smack  

由以上错误日志可以定位到类IQBindHandler,该类有方法handleIQ如下

 @Override
	public IQ handleIQ(IQ packet) throws UnauthorizedException {
        LocalClientSession session = (LocalClientSession) sessionManager.getSession(packet.getFrom());
        // If no session was found then answer an error (if possible)
        if (session == null) {
            Log.error("Error during resource binding. Session not found in " +
                    sessionManager.getPreAuthenticatedKeys() +
                    " for key " +
                    packet.getFrom());
            // This error packet will probably won't make it through
            IQ reply = IQ.createResultIQ(packet);
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(PacketError.Condition.internal_server_error);
            return reply;
        }
有以上代码可知,这是session为null时返回该错误,再来看看session何时为空,切换到代码 getSession

public ClientSession getSession(JID from) {
        // Return null if the JID is null or belongs to a foreign server. If the server is
        // shutting down then serverName will be null so answer null too in this case.
        if (from == null || serverName == null || !serverName.equals(from.getDomain())) {
            return null;
        }

        // Initially Check preAuthenticated Sessions
        if (from.getResource() != null) {
            ClientSession session = localSessionManager.getPreAuthenticatedSessions().get(from.getResource());
            if (session != null) {
                return session;
            }
        }

        if (from.getResource() == null || from.getNode() == null) {
            return null;
        }

        return routingTable.getClientRoute(from);
    }

3种情况:

   1,JID from为空

   2,服务关闭

   3,服务为外部服务

通过对服务器的监控可以分析:客户端用户意外掉线,重新登录需要重新绑定,这时出现的问题

第一种情况从错误日志for key [email protected]/Smack得知,JID from不为空,且重新登录时用户登录信息还在,估可分析from.getResource() 或

from.getNode() 是否为空


第二种情况需要知道登录请求需要何种服务,查看类SessionManager可知,如果serverName为空则会首先报错Server not initialized,因此

         这种情况 

第三种情况需要知道是否存在其他服务


初步判断错误原因为;在退出时未发送登陆请求






阅读更多

更多精彩内容