Serialization and applets : can't unserialize objects?

P

PawnsMaster

Hi everyone,

I have a problem with serialization and applets : I have the following part
of code :
ObjectInputStream in = new ObjectInputStream(new
URL(Utilities.getCodeBase(), demoFile + ".sav").openStream());

componentsCount = in.read(); // no problem

System.out.println(componentsCount);
for(int i = 0; i < componentsCount; i++) {
Piece p = (Piece)in.readObject(); // !! problem
add(p);
}
in.close();

Which throws me this exception :

java.security.AccessControlException: access denied
(java.lang.RuntimePermission accessClassInPackage.sun.swing)

By signing the class I made the unserialization work. But I still have a
problem : when I'm accessing my applet from my computer, no problem, but
when I try to access it from another computer of the network, IE crashes !!!

Please help me I don't know what else to do .
 
A

Andrew Thompson

Please help me I don't know what else to do .

Are you swallowing exceptions?

This situation of IE crashing is most unfortunate,
do you acrually mean that IE terminates?

(Assuming no) Have you looked at the Java console in IE?
MSVM: Alt V(iew) | J(ava Console)
Sun VM: Alt T(ools) | Sun Java Console

What is an URL for an example fo the applet
(working or otherwise).
 
P

PawnsMaster

No, IE doesn't terminate, but it takes 100% of the processor !
And that's really curious, because when I call the applet from the server
where it is situated, it works fine, but if I call it from another computer
of the network it gets IE to do that crappy thing ...

Thanks for helping
 
A

Andrew Thompson

On Tue, 28 Jun 2005 14:53:26 +0200, PawnsMaster wrote:

Please refrain from top-posting)
No, IE doesn't terminate,

Good, so we can probably get more details easily.
..but it takes 100% of the processor !
And that's really curious, because when I call the applet from the server
where it is situated, it works fine, but if I call it from another computer
of the network it gets IE to do that crappy thing ...

Turn curiosity to information..
System.out.println( "method name/params return value" )
at the start and end of every method, chack that yoiu
are not swallowing *any* exceptions then look closely
at the console.

If that fails, resort to..
 
P

PawnsMaster

I was wondering .. is it possible that the fact that I'm using JApplet could
be the problem ?
I put some debug lines to every functions, but it's crashing randomly,
sometimes It unserializes all of my elements but crash after, sometimes it
stops to the first element .... I can't understand where it does come from
 
A

Andrew Thompson

I was wondering .. is it possible that the fact that I'm using JApplet could
be the problem ?

Not very likely(*), but you can test that theory by
stripping the processes from behind the GUI and
seeing if that crashes.

* The only cause of this that I can think of is
'buggy Swing implementation in particular JRE',
but I have not heard of any Swing bugs that seem
related to the problem as described.
I put some debug lines to every functions, but it's crashing randomly,
sometimes It unserializes all of my elements but crash after, sometimes it
stops to the first element .... I can't understand where it does come from

You need to proceed to an URL and code example to
have a good chance of progressing this further.

And again - *Please refrain from top-posting*
If you do not understand what that is,
please Google 'top-posting'.
 
R

Roedy Green

By signing the class I made the unserialization work. But I still have a
problem : when I'm accessing my applet from my computer, no problem, but
when I try to access it from another computer of the network, IE crashes !!!

unsigned Applets have many restrictions. See
http://mindprod.com/jgloss/applet.html
http://mindprod.com/jgloss/signedapplets.html

--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm

Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
 
R

Roedy Green

(Assuming no) Have you looked at the Java console in IE?
MSVM: Alt V(iew) | J(ava Console)
Sun VM: Alt T(ools) | Sun Java Console

for hints on various browsers to see the console see
http://mindprod.com/jgloss/console.html

--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm

Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
 
R

Roedy Green

I was wondering .. is it possible that the fact that I'm using JApplet could
be the problem ?
I put some debug lines to every functions, but it's crashing randomly,
sometimes It unserializes all of my elements but crash after, sometimes it
stops to the first element .... I can't understand where it does come from

see http://mindprod.com/jgloss/applet.html

for how to turn your Applet into an hybrid that can also run as an
application. Then it is much easier to debug.

--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm

Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top