You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by BennyAR <be...@atchik-realtime.com> on 2010/03/22 13:12:20 UTC

ObjectMessage and sharing Class between client and server

Perhaps I've missed something, but I cannot find any documentation on how to
successfully send a custom object (some simple POJO) between a client and
server using an ActiveMQ broker. 

They are not running in the same JVM, so how do you cast the object without
getting
Caught:javax.jms.JMSException: Failed to build body from content.
Serializable class not available to broker. Reason:
java.lang.ClassNotFoundException: com.blah.test.MyObj

i.e. both the sender and receiver must know about the the POJO class
definition. 

Is there a way to add classes to the broker classpath? Or do I add a jar
file containing the POJO in the lib folder of activemq? Or do I need to use
Spring or Camel to create some kind of application context?
-- 
View this message in context: http://old.nabble.com/ObjectMessage-and-sharing-Class-between-client-and-server-tp27985506p27985506.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: ObjectMessage and sharing Class between client and server

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi,

it's easy to add classes to the broker's classpath. Just put you JAR into
lib/ folder and that's it.

Cheers
--
Dejan Bosanac - http://twitter.com/dejanb

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Mon, Mar 22, 2010 at 1:12 PM, BennyAR <benny.hjertaas@atchik-realtime.com
> wrote:

>
> Perhaps I've missed something, but I cannot find any documentation on how
> to
> successfully send a custom object (some simple POJO) between a client and
> server using an ActiveMQ broker.
>
> They are not running in the same JVM, so how do you cast the object without
> getting
> Caught:javax.jms.JMSException: Failed to build body from content.
> Serializable class not available to broker. Reason:
> java.lang.ClassNotFoundException: com.blah.test.MyObj
>
> i.e. both the sender and receiver must know about the the POJO class
> definition.
>
> Is there a way to add classes to the broker classpath? Or do I add a jar
> file containing the POJO in the lib folder of activemq? Or do I need to use
> Spring or Camel to create some kind of application context?
> --
> View this message in context:
> http://old.nabble.com/ObjectMessage-and-sharing-Class-between-client-and-server-tp27985506p27985506.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>