Friday, July 9, 2010

Problem with Red5 - SLF4JLogFactory does not implement LogFactory

I'm currently working on a team of more at least 16 developers -- the largest team I worked with on a very complicated project.

The setup is a central J2EE application that runs on JBoss, web application that written in PHP (powered by Apache web server), and a rich internet application written in ActionScript (yep, a Flash application). This Flash application communicates to Red5 server which runs on Tomcat.

If that's not complicated enough for you, continue reading.

The Flash application is a sub-application of the PHP web application. Both the PHP and Flash applications communicates to J2EE application. The PHP uses WSDL and the Flash uses Axis.

The PHP application gives data to the Flash application to let the Red5 server communicate with the J2EE application-- again, via Axis.

To make matters worse, the JBoss, Apache, and Tomcat servers are running on three different machines.

Now, when something in the process broke, it's up to the lead developers to debug it.

As I am the lead on the Flash application that communicates on Red5 server, I am oblige to find the solution.

How on Earth are you going to debug which caused which bug?

Well, the good thing in this complicated project is that it uses free and open source software and open data -- except for Adobe Flash specifics, that is. (For the record, I'm using the open source Flex SDK with FlashDevelop -- it's the Flash' SharedObject-thingy that Red5 uses I'm worried about not being open format/data)

Step-by-step, it boiled down to Red5 and Axis.

Another good thing is, a good person with a good heart by the name Jim O'Halloran, blogged about his same experience, six months earlier.

It turns out that Axis uses commons-logging.jar, which contains same classes (but not same version) of what Red5 uses. This makes the error that Red5 kept whining about:
Caused by: org.apache.commons.discovery.DiscoveryException: Class org.apache.commons.logging.impl.SLF4JLogFactory does not implement org.apache.commons.logging.LogFactory

As O'Halloran suggested, removing the JAR file for commons-logging then restarting Red5 will solve the problem. And it did!

If this helped you too, thank Jim O'Halloran. Send him beer or pizza if you could. ^^