bad_application 启动 erlang gen_server 应用程序时出错

发布于 2024-08-28 13:01:22 字数 273 浏览 5 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

缪败 2024-09-04 13:01:22

"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.

別甾虛僞 2024-09-04 13:01:22

我假设您的配置文件中有错误。您可以尝试做的一件事是,

file:consult("<your-app-config-file>").

如果它返回错误,您就会知道这就是问题所在。

I assume there is an error in your config file. One thing you could try to do is

file:consult("<your-app-config-file>").

If it returns an error, you'll know thats the problem..

浮光之海 2024-09-04 13:01:22

您可能还想查看以下有关如何调试 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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文