Saturday, December 5, 2009

Enable Custom Sounds on the Motorola Droid

Although it is not immediately apparent, the Motorola Droid does support custom ringtones and other sounds. All you have to do is create the appropriate directory structure on the microSD card. First, connect the Droid to your computer. Then, navigate to the memory card and create a folder called "Media". Inside the "Media" folder, create a folder called "Audio". Inside the "Audio" folder, create three folders. Their names should be "Alarms", "Notifications", and "Ringtones". Now just drag-n-drop the sound files you want into their respective folders. When you disconnect the phone from your computer the new sound files will show up on the appropriate menus.

Thursday, December 3, 2009

Fix MessageBroker/AMF error with BlazeDS and Tomcat

As part of a project I am working on, my team is building a dashboard using Adobe Flex that interacts with a back end database. The complete stack we are using is Adobe Flex, BlazeDS, Spring, Hibernate, Oracle 10g. Adobe Flex provides the rich platform for developing the dashboard. BlazeDS serves as the messaging broker between the Flex front end and Spring. Spring is a framework that we are using to perform our necessary business logic. Hibernate is a persistence layer for maintaining connections with the database. Oracle 10g is the database we are using to store our data. We are using Apache Tomcat 6 as our web/application server running on Ubuntu 9.04.

To build the project my team has been using a combination of two IDEs. Adobe Flex Builder is the primary development tool for building the dashboard. That code is then added to a project created using MyEclipse. We have been using MyEclipse because it provides for a very simple way to integrate Spring and Hibernate into a Java Web project. From there we can replace the contents of the WEB-INF and META-INF directories with the BlazeDS equivalents.

Our project would build and run perfectly on a local machine. The problem we ran into was that when we moved the built .war file to the server we would see a MessageBroker/AMF error when the dashboard tried to contact the database. This was our error:

Send failed

Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed:
url: 'http://{}:8080/{context.root}/messagebroker/amf'

After a lot of digging and frustration we found the problem to be the version of Tomcat6 that we were using. On our server we installed Tomcat from the repositories. That version does not support the necessary messaging services to use with BlazeDS. Instead, install Tomcat according to the instructions in this post.

Now, test if the messaging service is working by deploying your application, restarting Tomcat, and then navigate to: 
You should see a blank page. If you see anything else it is not working correctly.

Verify that you have a channel setup for messaging in {context.root}/WEB-INF/flex/services-config.xml. It should look similar to this:
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>

If you are still having problems, here are some of the other resources we came across. They didn't fix our problems but they might help fix yours: 

A big thanks to this post for solving our issue and to my team mate Phil for not giving up until this was working.