bad_application 启动 erlang gen_server 应用程序时出错
我使用 gen_server 编写了一个简单的 erlang 应用程序。
当使用 application:start(myapp) 启动它时,我得到以下元组...
{error,{bad_application,{appliction,myapp ...(我的应用程序配置的其余部分)。
没有其他错误或警告消息。我还尝试通过谷歌搜索如何配置 gen_server 以及错误本身的示例。我很惊讶那里的信息如此之少。
我可以开始尝试调试 OTP 吗?任何指示将不胜感激。
I have written a simple erlang app using gen_server.
When starting it with application:start(myapp), I get the following tuple...
{error,{bad_application,{appliction,myapp ... (rest of my application config).
There are no other error or warning messages. I have also tried to google examples of how to configure gen_server and also the error itself. I am surprised at how little information there is out there.
I could start trying to debug OTP?? Any pointers would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
"Application" 部分有很多关于如何实现 erlang 应用程序的信息OTP 设计原则。
听起来您正在尝试使用 gen_server 作为您正在启动的应用程序的回调。那是行不通的。
应用程序最常见的设置是有一个应用程序回调模块,该模块启动一个主管,该主管在某处有一个 gen_server 作为工作人员。应用程序根本不需要启动任何进程。应用程序的存在纯粹是为了将一些库模块加载到虚拟机中,例如 stdlib 应用程序。这使得其他应用程序可以依赖于库。
There is quite a lot of information on how to implement an erlang application in the "Application" section of OTP Design Principles.
It sounds like you are trying to use a gen_server as the callback for the application you are starting. That just wont work.
The most common setup for an application is to have an application callback module that starts up a supervisor that has a gen_server somewhere as a worker. Applications do not need to start any processes at all. Applications can exists purely to load some library modules into the vm, such as the
stdlib
application. That makes it possible for other applications to have dependencies on libraries.我假设您的配置文件中有错误。您可以尝试做的一件事是,
如果它返回错误,您就会知道这就是问题所在。
I assume there is an error in your config file. One thing you could try to do is
If it returns an error, you'll know thats the problem..
您可能还想查看以下有关如何调试 Erlang 函数的教程:
http://aloiroberto.wordpress.com/2009/02/23/tracing-erlang-functions/
You might also want to have a look to the following tutorial on how to debug Erlang functions:
http://aloiroberto.wordpress.com/2009/02/23/tracing-erlang-functions/