我无法在我的** helloworld **项目中使用ʻejabberd_auth` [英] I am unable to use `ejabberd_auth` in my **helloworld** project

查看:74
本文介绍了我无法在我的** helloworld **项目中使用ʻejabberd_auth`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在 helloworld 项目中使用 ejabberd_auth

I am unable to use ejabberd_auth in my helloworld project.

-behaviour(ejabberd_auth). 
... 
....  
try_register(<<"username">>, <<"example.com">>, <<"secret_password">>).  

这样我得到了错误警告:

With that I get the error warning:

helloworld.erl:15: Warning: behaviour ejabberd_auth undefined    











-import(ejabberd_auth, [try_register/3]).  
... 
....  
try_register(<<"username">>, <<"example.com">>, <<"secret_password">>).  

有了这个,我得到:

exception error: undefined function ejabberd_auth:try_register/3  






为什么我无法访问 ejabberd_auth


Why am I unable to access ejabberd_auth?

我正在使用IntelliJ Idea,并安装了Erlang插件。

I am using IntelliJ Idea, with the Erlang plugin installed.

谢谢大家。

更新:

我在Ubuntu 16.04 LTS上

UPDATE:
I'm on Ubuntu 16.04 LTS

推荐答案

我可以帮助您克服该错误。这是...

I can get you past that error. Here's how...

当我在erlang shell中编译模块时,编译器会创建一个 .beam 文件在同一目录中,这使我可以调用模块中定义的函数。就您而言,如果您进入目录:

When I compile a module in the erlang shell, the compiler creates a .beam file in the same directory, which allows me to call functions defined in the module. In your case, if you cd into the directory:

 .../ejabberd/ebin 

,您将看到所有ejabberd .beam文件,包括 ejabberd_auth.beam 。如果您在该目录中启动erlang shell,然后发出函数调用(不进行任何编译),则不会再收到该错误。

you will see all the ejabberd .beam files, including ejabberd_auth.beam. If you start an erlang shell in that directory, then issue your function call (don't compile anything), you won't get that error anymore.

但是,然后出现错误:

exception error: undefined function jid:nodeprep/1
     in function  ejabberd_auth:validate_credentials/3 (src/ejabberd_auth.erl, line 796)
     in call from ejabberd_auth:try_register/3 (src/ejabberd_auth.erl, line`

其中没有 jid.beam 文件但是:

~/Downloads/ejabberd$ find . -name jid.beam
./deps/xmpp/ebin/jid.beam

您将必须弄清楚如何编译模块,以便所有ejabberd模块都可用于您的程序。请参阅: ejabberd如何编译新模块

You are going to have to figure out how to compile your module so that all the ejabberd modules are available to your program. See: ejabberd how to compile new module.


我无法在helloworld项目中使用ejabberd_auth。

I am unable to use ejabberd_auth in my helloworld project.

您是否正在某个地方学习教程?

Are you following a tutorial somewhere?

这篇关于我无法在我的** helloworld **项目中使用ʻejabberd_auth`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆