Having issues with your BlazeDS/Flex app? Try changing the display-name

For days now (well, days in man hours, today is my first day back from vacation), I've been struggling with an issue concerning Flex and BlazeDS. Specifically an issue with the Flex front end receiving messages being sent by BlazeDS. I finally found the answer today, but before I go on, please note I'm a bit fuzzy on the details here - all I know is that it worked and I'm about as freaking relieved as a developer can get.

Ok, so I as said, the issue involved the use of BlazeDS and an Flex based AIR application. This is for work obviously so you also know that JBoss is running on the back end. For some reason, JBoss has refused to log any errors for me. I can get all kinds of nice console messages, but stack traces and other errors simply go into the void. So while I was sure there was a server side error, I was never ever to actually see it.

I then found this post, and Alex Glosband's suggestion for adding Service.Message.JMS to my services-config.xml file. This helped in that I could now see that when Flex tries to listen to BlazeDS, it was getting an error from the server. Unfortunately, the error was an NPE with no detail as to what was actually wrong. It did confirm though that the error was server side.

After getting a bit desperate, I tried a new search, this time including some of the result I was seeing in my console. My full search term was: jms destination null flex blazeds "There was an unhandled failure on the server. java.lang.NullPointerException"

This returned exactly two results, both on the Adobe forums. Unfortunately, when I clicked on one, I got a JavaScript alert:

ERROR: Sorry, you do not have permissions to access the requested object.

I was then pushed away from the thread. On a whim I thought - let me just disable JavaScript. There is no way that will work. Surprisingly, it does. (Folks, using JavaScript for security is not security.) I don't know if that is considered a hack or not, but the message post revealed something interesting. It mentioned the display-name value in web.xml. It suggested that if something else was using the same name, you could have a conflict. On a whim I edited the name, restarted, and bam, things began to work!

Long story short: If you are working with BlazeDS and finding that things don't seem to work, ensure you have a unique name in your web.xml file. I have zero idea what else is running on my box that could be using that value, but, I don't care. It works!

Comments

dbmuse's Gravatar and the default display name that you changed was ?
# Posted By dbmuse | 1/5/09 5:58 PM
Raymond Camden's Gravatar It was BlazeDS, which I assume is a default.
# Posted By Raymond Camden | 1/5/09 6:28 PM
David Stockton's Gravatar Hi Ray,

Please forgive the marketing angle but I think this is really useful information (for you and others)...

Did you know that FusionReactor the CF server monitor runs on practically any J2EE Server?

"JRun, JBoss, Websphere, Weblogic and can be installed on any servlet or J2EE engine e.g. Tomcat, Jetty"

You can get the same functionality/interface as you do when you're monitoring CF pages (FusionReactor can decode AMF!).

What's more... because FusionReactor licences are per server not per instance if you're running this on a machine that already has FusionReactor installed you get this for no extra cost! If you have the Enterprise version then you don't even need to run the installer - just go to "Enterprise -> Instance Manager" and follow the instructions to add your JBoss instance.

Maybe this will help you get some more debugging info?

Best of luck!
David
# Posted By David Stockton | 1/6/09 3:22 AM
Raymond Camden's Gravatar Would it report issues fired by Java code?
# Posted By Raymond Camden | 1/6/09 6:46 AM
David Stockton's Gravatar Yes... Java, JSP... whatever is running you can stack-trace.
# Posted By David Stockton | 1/6/09 6:56 AM
Raj's Gravatar Many thanks for posting this fix. It amazes me that something silly like that would cause a fundamental problem with BlazeDS. I was stuck for the entire day because of this stupid issue. Thanks again.
# Posted By Raj | 2/26/09 9:54 PM
Corev2's Gravatar Man !
You saved me a lot of time. That really works despite I couldn't believe. Thanks a lot.
# Posted By Corev2 | 4/18/09 11:34 AM