-
1. Re: javax.jms.JMSException: Failed to serialize object
clebert.suconic Dec 28, 2010 11:54 PM (in response to frh10)What is this DataContainer? Is it from JBoss Serialization?
You need to provide a proper Serializable Object as part of the ObjectMessage. HornetQ is using java standard serialization.
It will work as long as ObjectOutputStream.writeObject works. Nothing special here.
-
2. Re: javax.jms.JMSException: Failed to serialize object
frh10 Dec 29, 2010 1:21 AM (in response to clebert.suconic)DataContainer is a class which implements java.io.Serializable,in that way dc(DataContainer dc=new DataContainer()) is a proper Serializable Object.why also throw this error?how i need to change to solve this?
-
3. Re: javax.jms.JMSException: Failed to serialize object
clebert.suconic Dec 29, 2010 10:50 AM (in response to frh10)1 of 1 people found this helpfulUse a proper Serializable Object. Use a HashMap instead and add it to the ObjectMessage.
DataContainer is supposed to be used with JBoss Serialization which is support on HornetQ.
Also: JBoss Serialization was created during a time Sun Microsystems was stubborn about the issues on serialization. Since I've created that project, Sun made several changes on the meta-data, allowing concurrent use. JBoss Serialization may still be faster in some cases, but the biggest gain in performance is now moot with the latest changes on the JDK.
-
4. Re: javax.jms.JMSException: Failed to serialize object
frh10 Dec 30, 2010 9:59 PM (in response to clebert.suconic)Hi!
I have used a HashMap to store the DataContainer instance,and add the hashmap to the ObjectMessage.But also throw this error.
-
5. Re: javax.jms.JMSException: Failed to serialize object
clebert.suconic Dec 31, 2010 12:38 PM (in response to frh10)All you are required to do is:
All you have to do is to provide a Serializable object inside your HashMap. That simple.
If you provide something that can't be serializable.. then it can't be...
Just do a simple test:
HashMap map = new HashMap();
map.put("k", yourObject);
ObjectOutputStream out = ... (create a simple outputStream)
out.writeObject(map);
Do the same equivalent to read the object from the OutputStream.
-
6. Re: javax.jms.JMSException: Failed to serialize object
frh10 Jan 3, 2011 7:56 PM (in response to clebert.suconic)Thanks very much,i get it.
-
7. Re: javax.jms.JMSException: Failed to serialize object
leminhphung Apr 21, 2011 11:18 PM (in response to frh10)Hi frh10ff,
I cannot do it.
Could you please share your code which resolve the bug.
if you cannot public it, let send email to me.
my email : leminhphung@gmail.com
-
8. Re: javax.jms.JMSException: Failed to serialize object
clebert.suconic Apr 22, 2011 2:06 AM (in response to leminhphung)Which bug? there's no bug.. you just need to use proper serialization. It's your code after all.
-
9. Re: javax.jms.JMSException: Failed to serialize object
leminhphung Apr 22, 2011 2:11 AM (in response to clebert.suconic)Dear Suconic,
I also have a bug same frh10ff's bug.
This's "javax.jms.JMSException: Failed to serialize object". I don't know why that.
-
10. Re: javax.jms.JMSException: Failed to serialize object
clebert.suconic Apr 22, 2011 2:28 AM (in response to leminhphung)Failed o serialize object: it's pretty obvious.. you have an error in your serialization definitions. This is just pure java. Nothing that we can do for you here.
you just need to be able to do any regular ObjectOutputStream::writeObject
There's no bug here.. you just need to fix your serialization code.
If you don' know how to execute a simple ObjectOutputStream::writeObject to validate you client, please refer to any Java tutorial, or ask question at java forums.
-
11. Re: javax.jms.JMSException: Failed to serialize object
leminhphung Apr 22, 2011 4:23 AM (in response to clebert.suconic)Hi Suconic,
I have checked my object.It implemented Serializable.But when i create ObjectMessage --> throw Exception.
My Ojbect :
public abstract Person implements Serializable{
private String Name;
private String Address;
}
and my code use Person:
Person per = new Person;
per.setName("My Name");
per.setAddress("VietNam");
message = session.createObjectMessage();
message.setObject(obj);--> throw exception.
I use serialized object to use JMS send object message .
Do you have a email or yahoo nick or gmail account.
May i contact direct with you?
-
12. Re: javax.jms.JMSException: Failed to serialize object
clebert.suconic Apr 25, 2011 12:30 PM (in response to leminhphung)No you may not
Ypu have a simple java question here. As I said go look in a java tutorial. Just use a simple objectoutputsteam and you will figure out.
-
13. Re: javax.jms.JMSException: Failed to serialize object
leminhphung Apr 24, 2011 11:01 PM (in response to clebert.suconic)Hi Suconic,
Thanks for your support.
I used ObjectOutputStream to write object to a file and i get sub-objects that are not serialized.
-
14. Re: javax.jms.JMSException: Failed to serialize object
clebert.suconic Apr 25, 2011 11:04 AM (in response to leminhphung)That means you found your issue...
We don't do anything special with serialization. Just what you did to a ByteArray instead of a file.