Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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.

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/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top