【问题标题】:ejabberd mod_archive_odbc internal-server-errorejabberd mod_archive_odbc 内部服务器错误
【发布时间】:2023-03-13 14:39:01
【问题描述】:

我正在尝试使用 Strophe 从 ejabberd 服务器检索消息集合。我使用查询:

$iq({type: 'get'}).c('retrieve', {xmlns: 'http://www.xmpp.org/extensions/xep-0136.html#ns', with:'pivo@localhost/local',  start: '2012-10-28T17:38:00.000000Z'}).c('set', {xmlns: 'http://jabber.org/protocol/rsm'}).c('max').t('100');

这将为我生成以下 XMPP 数据包:

<iq type='get' xmlns='jabber:client'>
    <retrieve xmlns='http://www.xmpp.org/extensions/xep-0136.html#ns' with='pivo@localhost/local' start='2012-10-28T17:38:00.000000Z'>
        <set xmlns='http://jabber.org/protocol/rsm'>
            <max>100</max>
        </set>
    </retrieve>
</iq> 

但问题是服务器没有回复成功,他返回给我内部服务器错误。

如果我查看 Postgres 日志,我会发现以下错误:

**ERROR:  date/time field value out of range: "0000-01-01 00:00:00" at character 68**

我正在使用 ejabberd 2.1.10、pgsql 9.1。

有人可以帮我解决这个问题吗?

【问题讨论】:

    标签: erlang xmpp ejabberd strophe


    【解决方案1】:

    首先你必须检查这个集合是否存在。 你可以这样做:

    <iq type='get' id='123456'>
      <list xmlns='http://www.xmpp.org/extensions/xep-0136.html#ns'
            with='jabbar@localhost'>
        <set xmlns='http://jabber.org/protocol/rsm'>
          <max>30</max>/*max number of collection that you want to retrieve*/ 
        </set>
      </list>
    </iq>
    

    来自 ejabberd 的回应:

    <iq xmlns='jabber:client'
        from='root@localhost'
        to='root@localhost/24975890851351278205927376'
        id='123456'
        type='result'>
    <list xmlns='http://www.xmpp.org/extensions/xep-0136.html#ns'>
    <chat with='jabbar@localhost/2021512663135182487476431'
          start='2012-10-24T13:45:17.000000Z'/>
    <chat with='jabbar@localhost/9286394041351135710472543'
          start='2012-10-25T20:09:13.000000Z'/>
    <chat with='jabbar@localhost/9286394041351135710472543'
          start='2012-10-25T21:22:13.000000Z'/>/****** I will retrieve this *****/
    <chat with='jabbar@localhost/9286394041351135710472543'
          start='2012-10-25T22:05:13.000000Z'/>
    <chat with='jabbar@localhost'
          start='2012-10-25T23:03:14.000000Z'/>
    <chat with='jabbar@localhost'
          start='2012-10-25T23:35:37.000000Z'/>
    <set xmlns='http://jabber.org/protocol/rsm'>
    <first index='0'>
    63518305517@1
    </first>
    <last>
    63518427337@15
    </last>
    <changed>
    2012-10-25T23:37:21.000000Z
    </changed>
    <count>
    6
    </count>
    </set>
    </list>
    </iq>
    

    现在要从集合中检索消息,您必须在请求节中准确输入“start”和“with”:

    <iq type='get' id='433534536'>
      <retrieve xmlns='http://www.xmpp.org/extensions/xep-0136.html#ns'
                with='jabbar@localhost/9286394041351135710472543'
                start='2012-10-25T21:22:13.000000Z'>
        <set xmlns='http://jabber.org/protocol/rsm'>
          <max>100</max>
        </set>
      </retrieve>
    </iq>
    

    回复:

    <iq xmlns='jabber:client'
        from='root@localhost'
        to='root@localhost/24975890851351278205927376'
        id='433534536'
        type='result'>
    <chat with='jabbar@localhost/9286394041351135710472543'
          start='2012-10-25T21:22:13.000000Z'>
    <from secs='0'>
    <body>
    dddddddddd
    </body>
    </from>
    <from secs='1'>
    <body>
    dddddddd
    </body>
    </from>
    <set xmlns='http://jabber.org/protocol/rsm'>
    <first index='0'>
    63518419333@103
    </first>
    <last>
    63518419334@105
    </last>
    <changed>
    2012-10-25T21:22:14.000000Z
    </changed>
    <count>
    2
    </count>
    </set>
    </chat>
    </iq>
    

    【讨论】:

    • 我正在尝试完全相同的事情,但出现错误。如果我查询不存在的集合,他会返回“未找到项目”,但如果我查询正确的集合,他会返回错误:(。你在 ejabberd 服务器端使用什么模式?
    • 我将 mod_archive_odbc 与 mysql 外部数据库一起使用。您的数据库架构是否正确?查看 ejabberd 表并确保您想要检索的集合和时间(UTC)存在。
    • 我将创建 REST 服务来获取某些集合的消息,似乎 pgsql 9.1 的 mod_archive_odbc 与 UTC 时间有一些错误。不幸的是,这个版本的ejabberd的mod_archive_odbc被贬低了,作者为新的ejabberd开发了mod
    猜你喜欢
    • 2014-01-20
    • 2013-05-06
    • 1970-01-01
    • 2011-07-28
    • 1970-01-01
    • 2017-04-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多