Flex, Java Remoting, and JMS [null message body]
7 August 2008So I was pounding out some code this afternoon, ran into a small snag and thought I’d post. Neuro-physiologists tell us that we better remember what we write down so here goes.
Similar to my post a few months ago, I made a simple omission in my coding flurry.
I was working with a backend Java class that published messages to [ActiveMQ] JMS. I wrote up a simple VO class to publish via JMS.
package com.dl.sifagents.vo;
import java.io.Serializable;
public class ZISEventVO implements Serializable
{
public String eventType = "";
public String payloadPackage = "";
public String payloadElement = "";
public String xml = "";
}
On the Flex side, I wrote up an AS3 implementation
package com.dl.sifagents.vo
{
[RemoteClass(alias="com.dl.sifagents.vo.ZISEventVO")]
[Bindable]
public class ZISEventVO
{
public var eventType:String;
public var payloadPackage:String;
public var payloadElement:String;
public var xml:String;
}
}
I published the VO to JMS…
public void publishObjectToJMS(Serializable o)
{
try {
ObjectMessage message = _pubSession.createObjectMessage();
message.setObject(o);
_publisher.publish(message, Message.DEFAULT_DELIVERY_MODE, Message.DEFAULT_PRIORITY, 5 * 60 * 1000);
} catch (JMSException e1) {
e1.printStackTrace();
}
}
I’d received the JMS message in Flex (via BlazeDS) but the message body was null. I checked and doubled checked my Java VO implementation vs AS3 VO implementation and couldn’t find any naming conflicts or errors.
Then it hit me, in my haste I’d forgotten to upload the Java VO class to BlazeDS (i.e. to the WEB-INF/classes folder)!
That’s my piece of humble pie for the week
Back to work.









