Openfire returns 检索隐私列表时出现错误 500
Openfire returns error 500 when retrieving privacy lists
我正在使用 converse.js
并尝试使用隐私列表。我正在尝试发送此 IQ:
<body rid="2993056535" xmlns="http://jabber.org/protocol/httpbind" sid="578oe88nm1">
<iq from="alex3@ofb2" type="set" id="active1" xmlns="jabber:client">
<query xmlns="jabber:iq:privacy"/>
</iq>
</body>
这是什么服务器 returns 我:
<body xmlns="http://jabber.org/protocol/httpbind" ack="2993056535">
<iq xmlns="jabber:client" type="error" id="active1" to="alex3@ofb2/converse.js-90734653">
<query xmlns="jabber:iq:privacy"/>
<error code="500" type="wait">
<internal-server-error xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
</body>
在服务器日志中我看到这个异常:
2016.02.19 12:49:00 org.jivesoftware.openfire.handler.IQHandler - Internal server error
java.lang.NullPointerException
at org.jivesoftware.openfire.handler.IQPrivacyHandler.handleIQ(IQPrivacyHandler.java:120)
at org.jivesoftware.openfire.handler.IQHandler.process(IQHandler.java:66)
at org.jivesoftware.openfire.IQRouter.handle(IQRouter.java:372)
at org.jivesoftware.openfire.IQRouter.route(IQRouter.java:115)
at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:78)
at org.jivesoftware.openfire.SessionPacketRouter.route(SessionPacketRouter.java:108)
at org.jivesoftware.openfire.SessionPacketRouter.route(SessionPacketRouter.java:67)
at org.jivesoftware.openfire.http.HttpSession.sendPendingPackets(HttpSession.java:639)
at org.jivesoftware.openfire.http.HttpSession$HttpPacketSender.run(HttpSession.java:1270)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
怎么了?
堆栈跟踪 points to these lines:
// Privacy list handling (create/edit/delete)
Element list = child.element("list");
String listName = list.attributeValue("name");
也就是找子元素<list>
,找不到就崩溃
那么它为什么要寻找那个?事实证明,如果 IQ 的类型为 set
(并且既不是 <default>
也不是 <active>
子元素),这就是它所采用的分支。但是,如 XEP-0016 中所述,要获取现有隐私列表的名称,您需要发送类型为 get
的 IQ。您的请求应该如下所示:
<iq from='romeo@example.net/orchard' type='get' id='getlist1'>
<query xmlns='jabber:iq:privacy'/>
</iq>
我正在使用 converse.js
并尝试使用隐私列表。我正在尝试发送此 IQ:
<body rid="2993056535" xmlns="http://jabber.org/protocol/httpbind" sid="578oe88nm1">
<iq from="alex3@ofb2" type="set" id="active1" xmlns="jabber:client">
<query xmlns="jabber:iq:privacy"/>
</iq>
</body>
这是什么服务器 returns 我:
<body xmlns="http://jabber.org/protocol/httpbind" ack="2993056535">
<iq xmlns="jabber:client" type="error" id="active1" to="alex3@ofb2/converse.js-90734653">
<query xmlns="jabber:iq:privacy"/>
<error code="500" type="wait">
<internal-server-error xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
</body>
在服务器日志中我看到这个异常:
2016.02.19 12:49:00 org.jivesoftware.openfire.handler.IQHandler - Internal server error
java.lang.NullPointerException
at org.jivesoftware.openfire.handler.IQPrivacyHandler.handleIQ(IQPrivacyHandler.java:120)
at org.jivesoftware.openfire.handler.IQHandler.process(IQHandler.java:66)
at org.jivesoftware.openfire.IQRouter.handle(IQRouter.java:372)
at org.jivesoftware.openfire.IQRouter.route(IQRouter.java:115)
at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:78)
at org.jivesoftware.openfire.SessionPacketRouter.route(SessionPacketRouter.java:108)
at org.jivesoftware.openfire.SessionPacketRouter.route(SessionPacketRouter.java:67)
at org.jivesoftware.openfire.http.HttpSession.sendPendingPackets(HttpSession.java:639)
at org.jivesoftware.openfire.http.HttpSession$HttpPacketSender.run(HttpSession.java:1270)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
怎么了?
堆栈跟踪 points to these lines:
// Privacy list handling (create/edit/delete)
Element list = child.element("list");
String listName = list.attributeValue("name");
也就是找子元素<list>
,找不到就崩溃
那么它为什么要寻找那个?事实证明,如果 IQ 的类型为 set
(并且既不是 <default>
也不是 <active>
子元素),这就是它所采用的分支。但是,如 XEP-0016 中所述,要获取现有隐私列表的名称,您需要发送类型为 get
的 IQ。您的请求应该如下所示:
<iq from='romeo@example.net/orchard' type='get' id='getlist1'>
<query xmlns='jabber:iq:privacy'/>
</iq>