Archive for March, 2009

ActiveMQ NullPointer exceptions when creating objectmessages.

Posted on March 24, 2009. Filed under: Java |

At the moment, I’m working with Flex, BlazeDS en ActiveMQ in a Spring application. I’m using Flex to display some of my database contents, and for direct communication, I use BlazeDS, and for updating the view, I use JMS (ActiveMQ) in combation with BlazeDS. It works by publishing information to topics, which can be easily done using the following code:

    private void sendJmsUpdate() {
        this.jmsTemplate.send(this.destination, new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                return session.createObjectMessage(new ArrayList<TodoItem>(getList()));
            }
        });
    }

The above code uses the Spring JmsTemplate to created messages and send them to the topic. However, when I tried this, I got this exception:


java.lang.NullPointerException
at org.apache.activemq.ActiveMQMessageTransformation.copyProperties(ActiveMQMessageTransformation.java:188)
at org.apache.activemq.ActiveMQMessageTransformation.transformMessage(ActiveMQMessageTransformation.java:173)
at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1606)
at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:227)
at org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:241)
at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:572)
at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:549)
at org.springframework.jms.core.JmsTemplate$3.doInJms(JmsTemplate.java:516)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:447)
at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:514)
at org.epseelon.samples.todolist.business.TodoServiceImpl.sendJmsUpdate(TodoServiceImpl.java:77)
at org.epseelon.samples.todolist.business.TodoServiceImpl.save(TodoServiceImpl.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)

After a lot of Googling, I found nothing (well, a bug report somewhere, which was totally unrelated to what I had here). Why did I get this error?? I know my remoting was working (String were send), my objects were fine since I could get the list manually by doing a Refresh with the flex client itself (which used ≶mx:RemoteObject>) to call the Spring service…. And then it occured to me that the explanation was already here. I just overlooked it (hate it when that happens): the BlazeDS service apparently doesn’t require the objects (TodoItem) to be Serializable…. JMS ofcourse does! Argh! I forgot to implement Serializable here!

So, if you ever encounter this message, which is hardly descriptive at all, check your objects to see if they are all serializable. It saves a lot of debugging!

Read Full Post | Make a Comment ( 1 so far )

Dutch Groovy and Grails User Group

Posted on March 16, 2009. Filed under: NLGUG | Tags: , , , , |

At the moment, I’m busy reviving the Dutch Groovy and Grails User Group. The goal is to meet other local Groovy and Grails developers to talk about code, architecture, and lots of innovation. Both beginners and pros are ofcourse welcome!

I’ve already planned the first event, at (probably) May the 1st, which is viewable here

This evening will be an opportunity for software developers to meet people with different experience levels with the language and the framework. It will also be a good way to identify how to help your and other companies by using Grails. The program isn’t carved in stone yet, but if you have some suggestion, let me know!

Furthermore, I’ve setup an Linkedin group, to get an indication of the interest in Groovy and Grails in the Netherlands. You can join that group here.

So I hope you can help me make this a great succes, and let the Dutch GG community have a voice in the Netherlands!

I’m really dedicated to make this work, but I need your help! It would therefor be great if you could all join, so we can organize some interesting session.

Read Full Post | Make a Comment ( None so far )

Liked it here?
Why not try sites on the blogroll...