views:

293

answers:

3

I'm trying to link Mochiweb with my ejabberd mnesia db and am unable to do any mnesia transactions in my controllers. I test my controllers without the mnesia transactions and they work fine. I am using application:start(mnesia) inside the start function.

On the browser, I see "Internal server error" and on Mochiweb's log I see, "=ERROR REPORT=== function_clause". I'd like to know how to either 1.) get mnesia to work with Mochiweb or 2.) what a good framework I could plugin to ejabberd's web server is.

Thanks!

+1  A: 

Do you have the rest of the error message from Mochiweb's log - the bit after "function_clause" if it has it?

Rob Charlton
I know this may seem silly to ask... but where are the Log files for Mochiweb??
ewindsor
A: 

This must be an error within your code. Last time I checked the mochiweb source it wrapped your "loop" function within a try catch. If it caught an exception, it printed the type of that exception to the error log; in your case you have a function_clause exception.

Either try calling your loop function manually, or wrap your code in yet another try catch to be able to see the whole exception. If you can't decipher it, paste it to your question please.

Zed
A: 

You know, I think I was doing it all wrong... I was thinking it would work like PHP/SQL and Rails/SQL, but it seems the best way to do this is calling methods from the Mochiweb node to the ejabberd node.

Also I noticed that when I started Mochiweb connected to the same mnesia database as ejabberd, it tried to "repair" some of my tables - basically erasing everything.

If anyone has any input on this (or if I'm totally off) please let me know. Thanks!

ewindsor