Hey all,

AcitveMQ 4.1.0, Jencks 1.1

I'm trying not to serialized ObjectMessage content while using jvm
transport. I can't force connectionFactory (or something else) to stop
serializing.

This is how the Spring conf looks like:

        <bean id="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL">
                        <value>vm://localhost</value>
                </property>
                <property name="objectMessageSerializationDefered">
                        <value>true</value>
                </property>
        </bean>

        <bean id="jmsResourceAdapter"
class="org.apache.activemq.ra.ActiveMQResourceAdapter">
                <property name="connectionFactory" ref="connectionFactory"/>
        </bean>


        <bean id="jencks" class="org.jencks.JCAContainer">
                <property name="bootstrapContext">
                        <bean 
class="org.jencks.factory.BootstrapContextFactoryBean">
                                <property name="threadPoolSize" value="5"/>
                        </bean>
                </property>
                <property name="resourceAdapter">
                        <ref bean="jmsResourceAdapter"/>
                </property>
        </bean>

        <bean id="eventQueueConsumer" class="org.jencks.JCAConnector">
                <property name="jcaContainer" ref="jencks" />

                <property name="activationSpec">
                        <bean 
class="org.apache.activemq.ra.ActiveMQActivationSpec">
                                <property name="destination" value="eventQueue" 
/>
                                <property name="destinationType" 
value="javax.jms.Queue" />
                        </bean>
                </property>
                <property name="ref" value="dispatcher" />
        </bean>

<!-- for sending-->
        <bean id="jmsFactory"
                class="org.apache.activemq.pool.PooledConnectionFactory">
                <property name="connectionFactory" ref="connectionFactory"/>
        </bean>


        <bean id="eventSender"
                
class="com.avedya.zapzone2.eventframework.client.EventQueueClient"
                singleton="true">
                <property name="jmsTemplate">
                        <bean class="org.springframework.jms.core.JmsTemplate">
                                <property name="connectionFactory">
                                        <ref local="connectionFactory" />
                                </property>
                        </bean>
                </property>
                <property name="queueName">
                        <value>eventQueue</value>
                </property>

        </bean>

</beans>

The eventSender class uses MessageCreator:
        
   private class ObjectMessageCreator implements MessageCreator{
                
                private Serializable object;
                
                public ObjectMessageCreator(Serializable object){
                        this.object = object;
                }

                public Message createMessage(Session session) throws 
JMSException {
                        ObjectMessage msg = session.createObjectMessage();
                        msg.setObject(object);
                        return msg;
                }
                
        }
        
and sends using:

       jmsTemplate.send(queueName,new ObjectMessageCreator(event));

what I get is:

Caused by: java.io.NotSerializableException: javax.mail.internet.MimeMessage
        at java.io.ObjectOutputStream.writeObject0(Unknown Source)
        at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
        at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
        at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
        at java.io.ObjectOutputStream.writeObject0(Unknown Source)
        at java.io.ObjectOutputStream.writeObject(Unknown Source)
        at
org.apache.activemq.command.ActiveMQObjectMessage.storeContent(ActiveMQObjectMessage.java:96)

where MimeMessage is a part of serializable Object being sent. 

Perhaps I do something wrong. I took me a while to figure out how to force
resourceAdpater to use given connectionFactory so I know there is a lot of
things I dont know about ActiveMq. Anyway, seems like setting
objectMessageSerializationDefered doesnt really do the trick.

I appreciate your help.
m.
-- 
View this message in context: 
http://www.nabble.com/Can%27t-turn-ObjectMessage-serialization-OFF%21%21-tf3016083.html#a8375884
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to