Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (426)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Shocking bug in XMLEncoder? Or me being stupid  (Read 1341 times)
0 Members and 1 Guest are viewing this topic.
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Posted 2006-05-26 16:01:47 »

Serializing an object that contains an emtpy LinkedList works fine on a anormal PC, but in headless environment dies at runtime with this:

[code[
java.lang.UnsatisfiedLinkError: /usr/lib/j2sdk1.4-sun/jre/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1586)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1503)
        at java.lang.Runtime.loadLibrary0(Runtime.java:788)
        at java.lang.System.loadLibrary(System.java:834)
        at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:38)
        at sun.awt.DebugHelper.<clinit>(DebugHelper.java:29)
        at java.awt.Component.<clinit>(Component.java:506)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:141)
        at java.beans.DefaultPersistenceDelegate.class$(DefaultPersistenceDelegate.java:83)
        at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:285)
        at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
        at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:103)
        at java.beans.Encoder.writeObject(Encoder.java:54)
        at java.beans.XMLEncoder.writeObject(XMLEncoder.java:249)
1  
2  
3  
Note: its trying to instantiate a Component. God knows why - I've triple checked the class and all classes it references (only one! And that in a non-bean method signature, so should be ignored. And one interface, ditto). None use any external classes or objects except for some in java.util (hashmap, linkedlist).

Any ideas? This makes no sense to me.

malloc will be first against the wall when the revolution comes...
Offline CommanderKeith
« Reply #1 - Posted 2006-05-30 07:56:33 »


I can't see why LinkedList would be the culprit, but to make sure its not, you could extend LinkedList and serialize it manually by over-riding writeObject(ObjectOutputStream out) & readObject(...).


Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #2 - Posted 2006-05-31 03:53:17 »

Clearly java.awt.Component is getting loaded for some reason.  Is it being used as a base-class of something?  Are there references to the GUI-related ListModel somewhere?

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline CommanderKeith
« Reply #3 - Posted 2006-05-31 09:54:49 »

I don't know anything about XMLEncoder,but clearly its different to ObjectOutputStream.  XMLEncoder's source seems to write objects using gnu.java.beans.encoder.ScanEnginewriteObject(o),but that class's source remains elusive.

The author of XMLEncoder did leave his personal email in the source if you want to try emailing him...

From http://developer.classpath.org/doc/java/beans/XMLEncoder-source.html#line.245

  39: package java.beans;
  40:
  41: import gnu.java.beans.encoder.ScanEngine;
  42:
  43: import java.io.OutputStream;
  44:
  45: /**
  46:  * This class uses the {@link PersistenceDelegate} and {@link Encoder}
  47:  * infrastructure to generate an XML representation of the objects it
  48:  * serializes.
  49:  *
  50:  * @author Robert Schuster (robertschuster@fsfe.org)
  51:  * @since 1.4
  52:  */
  53: public class XMLEncoder extends Encoder
  54: {
  55:   Object owner;
  56:
  57:   Exception exception;
  58:
  59:   ScanEngine scanEngine;


Maybe you should test whether the same problem occurs using regular ObjectOutputStream serialization as well as with XMLEncoder.

Offline kevglass

JGO Kernel


Medals: 85
Projects: 22


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #4 - Posted 2006-05-31 18:13:21 »

Isn't the code above from GNU Classpath  - where as the error comes from SUN's SDK?

Kev

Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #5 - Posted 2006-06-07 17:43:51 »

Clearly java.awt.Component is getting loaded for some reason.  Is it being used as a base-class of something?  Are there references to the GUI-related ListModel somewhere?

AFAICT ... No, and no. I spent half an hour meticulously checking that Sad.

malloc will be first against the wall when the revolution comes...
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #6 - Posted 2006-06-07 17:46:46 »

Ha! Yes, XMLEncoder has a shocking bug.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4816484

It's one of those screwed-up-design issues Smiley. Sob.

malloc will be first against the wall when the revolution comes...
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #7 - Posted 2006-06-08 03:03:29 »

From the evaluation:
Quote
Reproducible as described up through 1.4.2, but no longer reproducible in 1.5
 xxxxx@xxxxx  2004-08-03
This bug is no longer reproducible. The most likely reason is that the Toolkit initialization has been changed to occur when AWT components are shown or packed (or addNotify() is called).  For this reason, I will be closing this bug as not reproducible.

Perhaps it's time to move to Java 5 for that project... if it's feasible for you.

Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #8 - Posted 2006-06-08 13:07:32 »

Yeah, very very tight timeframe + this forced my hand. Just keeping fingers crossed that we don't hit any regression issues between now and launch Smiley.

malloc will be first against the wall when the revolution comes...
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (72 views)
2014-04-15 18:08:23

BurntPizza (68 views)
2014-04-15 03:46:01

UprightPath (79 views)
2014-04-14 17:39:50

UprightPath (65 views)
2014-04-14 17:35:47

Porlus (80 views)
2014-04-14 15:48:38

tom_mai78101 (104 views)
2014-04-10 04:04:31

BurntPizza (164 views)
2014-04-08 23:06:04

tom_mai78101 (260 views)
2014-04-05 13:34:39

trollwarrior1 (210 views)
2014-04-04 12:06:45

CJLetsGame (220 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!