2
votes

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.

3
The answer probably lies within the rest of the config...Zed
Yep, I agree that's probably where the answer lies. But how do I find out more? An error along the lines "Invalid mod specified"?? I'm just amazed that there is zero context returned.andyc

3 Answers

2
votes

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.

1
votes

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/

1
votes

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