Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error running ejabberd_app on eclipse #299

Open
blacklightknight opened this issue Mar 9, 2017 · 7 comments
Open

error running ejabberd_app on eclipse #299

blacklightknight opened this issue Mar 9, 2017 · 7 comments

Comments

@blacklightknight
Copy link

blacklightknight commented Mar 9, 2017

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
Copy link
Collaborator

vladdu commented Mar 9, 2017

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
Copy link
Author

blacklightknight commented Mar 10, 2017

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
Copy link
Collaborator

vladdu commented Mar 10, 2017

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
Copy link
Author

blacklightknight commented Mar 10, 2017

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
Copy link
Collaborator

vladdu commented Mar 10, 2017

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
Copy link
Author

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
Copy link
Collaborator

vladdu commented Mar 21, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants