title: JMS - Sending object message
body: <p>I want to send object message in jms and getting run time exception.
  Please suggest me possible solutions.</p>
  
  <p>JMS Code:</p>
  
  <pre><code>ObjectMessage objMessage = session.createObjectMessage();
          MessageData data = new MessageData();
          objMessage.setObject(data);
          sender.send(objMessage);
  </code></pre>
  
  <p>Exception found on console:</p>
  
  <pre><code>    log4j:WARN No appenders could be found for logger         org.jboss.remoting.transport.socket.MicroSocketClientInvoker).
      log4j:WARN Please initialize the log4j system properly.
      java.lang.RuntimeException: com.test.SendJMSMessage
  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.jboss.messaging.util.StreamUtils.writeObject(StreamUtils.java:249)
  at org.jboss.jms.message.JBossObjectMessage.doWriteObject(JBossObjectMessage.java:141)
  at org.jboss.messaging.core.impl.message.MessageSupport.getPayloadAsByteArray(MessageSupport.java:216)
  at org.jboss.jms.message.JBossObjectMessage.setObject(JBossObjectMessage.java:118)
  at org.jboss.jms.message.ObjectMessageProxy.setObject(ObjectMessageProxy.java:59)
  at com.test.SendJMSMessage.example(SendJMSMessage.java:36)
  at com.test.SendJMSMessage.main(SendJMSMessage.java:130)
  </code></pre>
  
  <p>After creating new MessageData class in place of creating subclass MessageData, when I run the code I got exceptions as below:</p>
  
  <pre><code>18:26:08,297 ERROR [JmsGatewayListener] Problems invoking method &lt;process&gt;
  java.lang.reflect.InvocationTargetException
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at org.jboss.soa.esb.listeners.gateway.JmsGatewayListener.doRun(JmsGatewayListener.java:161)
  at org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycle.run(AbstractThreadedManagedLifecycle.java:115)
  at java.lang.Thread.run(Unknown Source)
  
  Caused by: java.lang.RuntimeException: No ClassLoaders found for: com.test.MessageData
  at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:306)
  at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:521)
  at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:415)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClassInternal(Unknown Source)
  at java.lang.Class.forName0(Native Method)
  at java.lang.Class.forName(Unknown Source)
  at java.io.ObjectInputStream.resolveClass(Unknown Source)
  at org.jboss.messaging.util.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:78)
  at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
  at java.io.ObjectInputStream.readClassDesc(Unknown Source)
  at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
  at java.io.ObjectInputStream.readObject0(Unknown Source)
  at java.io.ObjectInputStream.readObject(Unknown Source)
  at org.jboss.messaging.util.StreamUtils.readObject(StreamUtils.java:154)
  at org.jboss.messaging.core.impl.message.MessageSupport.readPayload(MessageSupport.java:405)
  at org.jboss.jms.message.JBossObjectMessage.getObject(JBossObjectMessage.java:126)
  at org.jboss.jms.message.ObjectMessageProxy.getObject(ObjectMessageProxy.java:68)
  at org.jboss.soa.esb.listeners.gateway.PackageJmsMessageContents.setESBMessageBody(PackageJmsMessageContents.java:165)
  at org.jboss.soa.esb.listeners.gateway.PackageJmsMessageContents.process(PackageJmsMessageContents.java:89)
  ... 7 more
  </code></pre>
  
  <p>Here I am trying to send an object message to esb server code.
  Any suggestions on console window as above please?</p>