erlang / erlide_eclipse

Eclipse IDE for Erlang
http://erlide.org
202 stars 70 forks source link

error running ejabberd_app on eclipse #299

Open blacklightknight opened 7 years ago

blacklightknight commented 7 years ago

I have created a erlang project on eclipse IDE with ejabberd source code in it.I was trying to run the ejabberd_app module from eclipse console with the call ejabberd_app:start(normal,[]).But I got the following error: `** exception error: no function clause matching ejabberd_config:'-merge_configs/2-fun-1-'({host_config, <<"ldap.localhost">>, [{auth_method, ldap}, {ldap_servers, [<<"localhost">>]}, {ldap_port, 1389}, {ldap_rootdn, <<"cn=admin,dc=localhost">>}, {ldap_password, <<"password">>}, {ldap_base, <<"ou=users,dc=localhost">>}, {{add,modules}, [{mod_vcard_ldap, []}]}]},

{}) (c:/Users/Abhishek/workspace/actErlang/src/ejabberd_config.erl, line 484)

 in function  lists:foldl/3 (lists.erl, line 1262)
 in call from ejabberd_config:include_config_files/1 (c:/Users/Abhishek/workspace/actErlang/src/ejabberd_config.erl, line 518)
 in call from ejabberd_config:read_file/2 (c:/Users/Abhishek/workspace/actErlang/src/ejabberd_config.erl, line 165)
 in call from ejabberd_config:start/0 (c:/Users/Abhishek/workspace/actErlang/src/ejabberd_config.erl, line 65)
 in call from ejabberd_app:start/2 (ejabberd_app.erl, line 58)`

Anyone with any suggestions?

vladdu commented 7 years ago

Have you been able to compile and run ejabberd from outside Eclipse?

The lines in that error message are not matching my version (the latest master commit 6808865068), which one are you using?

blacklightknight commented 7 years ago

Actually I am using windows os, on which I have downloaded the windows installer from processone's site.I was able to successfully install and run ejabberd through command line and through desktop icons on my system.But in the process I actually never had to use individual modules of ejabberd like ejabeerd_app or ejabberd.erl. But then I decided to understand the source code of ejabberd on eclipse.After some trouble I was able to import the ejabberd source code into eclipse and compiled the ejabberd_app.erl file and ran it from console and with the call ejabberd_app:start(normal,[]). and the error which I got is shown below: (actErlang@DESKTOP-RI8MDR6)10> ejabberd_app:start(normal, []). ** exception error: no function clause matching ejabberd_config:'-merge_configs/2-fun-1-'({host_config, <<"ldap.localhost">>, [{auth_method, ldap}, {ldap_servers, [<<"localhost">>]}, {ldap_port, 1389}, {ldap_rootdn, <<"cn=admin,dc=localhost">>}, {ldap_password, <<"password">>}, {ldap_base, <<"ou=users,dc=localhost">>}, {{add,modules}, [{mod_vcard_ldap, []}]}]}, #{}) (c:/Users/Abhishek/workspace/actErlang/src/ejabberd_config.erl, line 483) in function lists:foldl/3 (lists.erl, line 1262) in call from ejabberd_config:include_config_files/1 (c:/Users/Abhishek/workspace/actErlang/src/ejabberd_config.erl, line 517) in call from ejabberd_config:read_file/2 (c:/Users/Abhishek/workspace/actErlang/src/ejabberd_config.erl, line 164) in call from ejabberd_config:start/0 (c:/Users/Abhishek/workspace/actErlang/src/ejabberd_config.erl, line 65) in call from ejabberd_app:start/2 (ejabberd_app.erl, line 58)

vladdu commented 7 years ago

The thing is that erlide needs to be able to compile the code in order to have it running. Ejabberd has a special way of building that is not supported by erlide. So when not all code gets compiled, there will be errors.

In short, for ejabberd you can use erlide for browsing the code, but not for compiling and running it. Sorry.

blacklightknight commented 7 years ago

so what should I do in order to run the ejabberd's source code in order to understand how the control and data flows from one ejabberd module to other. I just want to run the code in an IDE so that I can understand how ejabberd works.

vladdu commented 7 years ago

You can always use the OTP debugger. Or use tracing to display the sequence of calls.

For systems like ejabberd it may be difficult to run it through a debugger anyway, because if the code uses timeouts (including gen_server calls), then they will trigger while you are stepping through the code.

If you manage to get the project structure recognised by the IDE, then you can also browse manually through the calls (with "jump to definition").

blacklightknight commented 7 years ago

I have read about debugger in erlang's documentation, but wasn't able to understand that how to use it to test any one module like ejabberd_app or ejabberd.erl. Can you please explain how to run a given module say ejabberd_app using debugger or tracing.

vladdu commented 7 years ago

Sorry for the delay. If you can launch ejabberd from the Erlang shell, then yo ucan also launch de debugger with debugger:start(). The details are at http://erlang.org/doc/man/debugger.html. The tracing API is described at http://erlang.org/doc/man/dbg.html.