• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Queue Serialization fails

 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,

i am trying to serialize a PriorityQueue but i get an exception
the objects in the queue are serializable and it worked when i tried to only serialize an object from that queue.

is there a problem with serializing Queues ?
i checked where the exception is thrown.
When the queue tries to get the defaultWriteObject it crashes.

Thanks for advice
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you give us the full stack trace from the exception?
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sure :-)


 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You said all your classes you have in the queue are serializable. You've checked and double checked com.downloadengine.model.connector.proxy.ProxyPool, right?
Was this class not serializable and you recently changed it to be serializable? Have you made sure the updated class has been distributed everywhere it needs to be? If the exception occurs on an application server, have you rebuilt and redeployed the application (WAR, EAR)?
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey ...

this is an extract of the ProxyPool class




now if i change the queue to be transient ... the process goes thru ...
here is the proxy bean class




there are no other objects other than primitives and strings associated to the proxybean class


hope that helps
 
author
Posts: 23919
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

hey ...

this is an extract of the ProxyPool class



Does any of the methods of this class return an inner class? I don't think that it is this class that's the problem. It looks like the queue has an inner class of this class (which is not serializable).

Henry
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey,

there is no inner class in neither of the two classes
the proxyBean mostly constists of getters and setters. .
the pool starts an independent thread thats all ...

 
Henry Wong
author
Posts: 23919
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sebastian Janisch wrote:hey,

there is no inner class in neither of the two classes
the proxyBean mostly constists of getters and setters. .
the pool starts an independent thread thats all ...



Well, that is what is it complaining about.... BTW, it is an anonymous inner class, so you can't find it by looking for the class keyword.

Henry
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there is no inner class, nor anonymous in the ProxyBean class and that is where the problem is isnt it ??

is it helpful if i post the complete ProxyBean code so you can take a look at it ?
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think Henry's on to something:


The exception reports the problem is with ProxyPool$1, and '$' indicates a compiler generated class name.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
too weird there is no inner class whatsoever defined...

this is the eclipse outline .. hope that helps

ProxyPool_Outline.gif
[Thumbnail for ProxyPool_Outline.gif]
Eclipse Outline
 
Sheriff
Posts: 22650
126
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check that private ProxyPool constructor. It has a + in front of it, which means it has something inside. Usually that is a method local or anonymous inner class.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
gee you guys are fast :-)

that's whats inside the constructor

 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hold on

is that the inner class we are talking about ... gee i didnt see that thing
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok ...

i changed the constructor to the following and now it's working




thank you guys for your help
 
I can't beleive you just said that. Now I need to calm down with this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic