开发者

bad_application error starting erlang gen_server application

I have written a si开发者_运维技巧mple 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.


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

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

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


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/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜