[erlang-questions] ** exception error: bad argument in function ets:lookup_element/3

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Tue Dec 20 14:04:29 CET 2011


On 12/20/11 1:29 PM, raviraj555 wrote:
> Hi All,
> I m new in Erlang, when i do the mongodb connection it get connected
> successfully but if run any query inside function i m getting
> following error
>
> hello_
> ** exception error: bad argument
>       in function  ets:lookup_element/3
>          called as ets:lookup_element(mongodb_app,oid_machineprocid,2)
>       in call from mongodb_app:gen_objectid/0
>       in call from mongo:assign_id/1
>       in call from lists:map/2
>       in call from mongo:insert_all/2
>       in call from mongo:insert/2
>       in call from mongo:do/5
>       in call from art:run/0
The problem is that ets:lookup_element/3 returns badarg because 
something you passed to that function is not valid. Most likely, the 
problem is that there is no 'mongodb_app' ETS table created. My guess is 
that you need to application:start(mongodb) or something such which will 
initialize the table correctly. In other words the mongodb application 
has some initialization assumption which has not been run yet.

Hope this helps!

-- 
Jesper Louis Andersen
   Erlang Solutions Ltd., Copenhagen, DK




More information about the erlang-questions mailing list