javax.jms.JMSException: Failed to serialize object while creating ObjectMessage in jboss-as-7.1.1.Final
surendra.konna Jan 31, 2014 12:18 AMI am using jboss-as-7.1.1.Final and getting javax.jms.JMSException: Failed to serialize object exception when i tried to add entitybean to object .
And I am afraid that the same configuration works in Jboss 6.
ejb-jar.xml
-----------------------
<entity>
<ejb-name>MsLicensee</ejb-name>
<local-home>xxxxxxxxx.MsLicenseeHome</local-home>
<local>xxxxxxxxxx.MsLicensee.MsLicensee</local>
<ejb-class>xxxxxxxxxx.MsLicensee.MsLicenseeEJB</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Long</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>MsLicensee</abstract-schema-name>
<cmp-field> <field-name>licenseeId</field-name> </cmp-field>
<cmp-field> <field-name>companyId</field-name> </cmp-field>
<cmp-field> <field-name>corporateName</field-name> </cmp-field>
<cmp-field> <field-name>logoGifname</field-name> </cmp-field>
<cmp-field> <field-name>corporateUrl</field-name> </cmp-field>
<cmp-field> <field-name>licensedServices</field-name> </cmp-field>
<cmp-field> <field-name>productionMode</field-name> </cmp-field>
<primkey-field>licenseeId</primkey-field>
</entity>
jboss.xml
------------------
<entity>
<ejb-name>MsLicensee</ejb-name>
<local-jndi-name>XXXXXXXXXXX.MsLicenseeHome</local-jndi-name>
<method-attributes>
<method>
<method-name>get*</method-name>
<read-only>true</read-only>
</method>
</method-attributes>
</entity>
MsLicensee lic = Licensee.getLicensee(licenseeId.longValue());
ArrayList params=new ArrayList();
params.add(lic );
public class SendMailToQueue implements java.io.Serializable
{
public final static String JMS_FACTORY="ConnectionFactory";
public final static String QUEUE="queue/A";
private Queue queue;
private QueueSender qsender;
private QueueSession qsession;
private QueueConnection qcon;
private QueueConnectionFactory qconFactory;
private ObjectMessage msg;
public SendMailToQueue(){
try{
InitialContext ic = new InitialContext();
//InitialContext ic = EJBUtil.getInitialContext();
qconFactory = (QueueConnectionFactory) ic.lookup(JMS_FACTORY);
qcon = qconFactory.createQueueConnection();
queue = (Queue) ic.lookup(QUEUE);
qsession = qcon.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
qcon.start();
}
catch(Exception e){
e.printStackTrace();
}
}
public void send(ArrayList message) throws JMSException{
try{
qsender = qsession.createSender(queue);
msg = qsession.createObjectMessage(message); //getting exception here
System.out.println(" DEBUG >>>>> the createObjectMessage gave the MSG :: " + msg);
qsender.send(msg);
System.out.println(" DEBUG >>>>> Message added to queue for Delivery");
qsender.close();
}
catch(Exception e) {
e.printStackTrace();
}
}
public void close() throws JMSException{
qcon.stop();
qsession.close();
qcon.close();
}
}