Search code examples
erlangubuntu-14.04yaws

exception exit: "cannot load yaws"


I have been trying to embed yaws into an erlang application but no matter what I do I get this exception thrown out

** exception exit: "cannot load yaws"
     in function  yaws_api:embedded_start_conf/4 (yaws_api.erl, line 2598)
     in call from ybed:run/0 (ybed.erl, line 35)
3> 

I used yaws sample "ybed.erl" example but there is still no luck: http://hyber.org/code.yaws?file=/ybed.erl

I am using ubuntu 14.04

Update

As suggested by Steve Vinoski,It was a load path issue.

I included application:load(yaws) as instructed and the return value was {error,{"no such file or directory","yaws.app"}}. so I ran Erlang follows $ sudo erl -pa /usr/lib/yaws/ebin and it worked like charm.

Thank you!


Solution

  • This is almost certainly a load path issue, since the failure is caused by a call to application:load(yaws) failing inside yaws_api:embedded_start_conf/4. I don't know how you're creating or starting your application, but you need to make sure the yaws application is in the load path.

    To fully answer your question, we need to know why application:load(yaws) is failing. Temporarily change your copy of ybed.erl to call application:load(yaws) just before the call to yaws_api:embedded_start_conf/4, and see what application:load/1 returns. This will give you an indication of why the application:load/1 call inside yaws_api:embedded_start_conf/4 is failing.