mod_archive_webview does not work with ejabberd 2.0.1

Hi,
I am using ejabberd 2.0.1 on Debian Lenny which has been patched with mod_archive module taken from trunk. I have followed all the instructions in README.txt and http://www.ndl.kiev.ua/content/mod_archive_odbc-release for setting it up. The messages get archived properly. But when I try to access the archive via my browser using the URL http://localhost:5280/archive/ ejabberd, it throws an error as shown below in sasl.log:

=CRASH REPORT==== 13-Jul-2009::20:50:07 ===
  crasher:
    pid: <0.718.0>
    registered_name: []
    exception error: no function clause matching
                     mod_archive_webview:process([],
                                                 {request,'GET',
                                                  ["archive"],
                                                  [{nokey,[]}],
                                                  undefined,undefined,"en-us",
                                                  [],
                                                  {115,108,115,201}})
      in function  ejabberd_http:process_request/1
      in call from ejabberd_http:process_header/2
      in call from ejabberd_http:receive_headers/1
    initial call: ejabberd_http:receive_headers({state,gen_tcp,#Port<0.577>,
                                                 undefined,undefined,
                                                 undefined,undefined,
                                                 undefined,undefined,"en",
                                                 [{["archive"],
                                                   mod_archive_webview},
                                                  {["admin"],
                                                   ejabberd_web_admin},
                                                  {["http-poll"],
                                                   ejabberd_http_poll}],
                                                 false,[]})
    ancestors: [ejabberd_http_sup,ejabberd_sup,<0.37.0>]
    messages: []
    links: [<0.242.0>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 610
    stack_size: 23
    reductions: 364
  neighbours:

=SUPERVISOR REPORT==== 13-Jul-2009::20:50:07 ===
     Supervisor: {local,ejabberd_http_sup}
     Context:    child_terminated
     Reason:     function_clause
     Offender:   [{pid,<0.718.0>},
                  {name,undefined},
                  {mfa,
                      {ejabberd_http,start_link,
                          [{gen_tcp,#Port<0.577>},
                           [http_poll,web_admin,
                            {request_handlers,
                                [{["archive"],mod_archive_webview}]}]]}},
                  {restart_type,temporary},
                  {shutdown,brutal_kill},
                  {child_type,worker}]

I tried to debug but hardly have any knowledge of erlang. Is something wrong with my configuration or is mod_archive_webview broken? Looking forward for any possible support in resolving this issue.

Try simple change in Emakefile

Maybe the problem is that the compilation script of those mod_archive* modules is using header files from ejabberd trunk, but you attempt to use the compiled files in ejabberd 2.0.x.

Try this simple solution: edit mod_archive/trunk/Emakefile and replace all the appearances of:

trunk

with this:

branches/ejabberd-2.0.x

Then delete the files in ebin/ directory, recompile again, install the beam files again, start ejabberd, and let's see if it no longer throws that error.

Config page not working

Hi

I had the same problem, and changing the Emakefile has you told worked ok. I can now load the page http://localhost:5280/archive but when clicking on the link Config, I get a crash.

=CRASH REPORT==== 3-Aug-2009::10:41:59 ===
  crasher:
    pid: <0.572.0>
    registered_name: []
    error_info: {{badmatch,{-1,-1,-1,-1,-1,-1,-1}},
                  [{mod_archive_webview,global_config_form,2},
                   {mod_archive_webview,process2,3},
                   {ejabberd_http,process_request,1},
                   {ejabberd_http,process_header,2},
                   {ejabberd_http,receive_headers,1},
                   {proc_lib,init_p,5}]}
    initial_call: {ejabberd_http,receive_headers,
                                [{state,
                                     gen_tcp,
                                     #Port<0.475>,
                                     undefined,
                                     undefined,
                                     undefined,
                                     undefined,
                                     undefined,
                                     undefined,
                                     "en",
                                     [{["archive"],mod_archive_webview},
                                      {["admin"],ejabberd_web_admin},
                                      {["http-bind"],mod_http_bind},
                                      {["http-poll"],ejabberd_http_poll}],
                                     false,
                                     []}]}
    ancestors: [ejabberd_http_sup,ejabberd_sup,<0.40.0>]
    messages: []
    links: [<0.244.0>,#Port<0.475>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 4181
    stack_size: 21
    reductions: 3146
  neighbours:

=SUPERVISOR REPORT==== 3-Aug-2009::10:41:59 ===
     Supervisor: {local,ejabberd_http_sup}
     Context:    child_terminated
     Reason:     {{badmatch,{-1,-1,-1,-1,-1,-1,-1}},
                  [{mod_archive_webview,global_config_form,2},
                   {mod_archive_webview,process2,3},
                   {ejabberd_http,process_request,1},
                   {ejabberd_http,process_header,2},
                   {ejabberd_http,receive_headers,1},
                   {proc_lib,init_p,5}]}
     Offender:   [{pid,<0.572.0>},
                  {name,undefined},
                  {mfa,{ejabberd_http,start_link,
                                      [{gen_tcp,#Port<0.475>},
                                       [http_bind,
                                        http_poll,
                                        {request_handlers,
                                            [{["archive"],mod_archive_webview}]},
                                        web_admin]]}},
                  {restart_type,temporary},
                  {shutdown,brutal_kill},
                  {child_type,worker}]

I don't know the internals of

I don't know the internals of that module. Please contact the author so he fixes it in the SVN:
Email: Olivier Goffart

Maybe this solves the problem. Remember to tell the author if this solved it or not:

--- trunk/src/mod_archive_webview.erl   (revisión: 995)
+++ trunk/src/mod_archive_webview.erl   (copia de trabajo)
@@ -229,7 +229,7 @@
                 " FROM archive_global_prefs"
                 " WHERE us = " ++ get_us_escaped({LUser,LServer}) ) end) of
             {selected, _ , [ Ok ]} -> Ok;
-            {selected, _ , [ ]} -> { -1, -1, -1, -1, -1, -1, -1 }
+            {selected, _ , [ ]} -> { -1, -1, -1 }
         end,
    [?XAE("form",[{"action",?LINK("config/submit/global")}],
          [?XE("label",[?CT("Disable or enable automatic archiving globaly: "), select_element("global_auto_save",

Fix

Patch given at http://www.ndl.kiev.ua/content/mod_archive_odbc-release#comment-265 should fixes this problem. The patch has been tested with ejabberd 2.1.5 and mod_archive r1057.

Syndicate content