Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Java Serialized objects

Reply
Thread Tools

Java Serialized objects

 
 
Chandrashekar Tippur
Guest
Posts: n/a
 
      04-25-2004
All,

I have a serialized object which reads and writes to a file. While it
reads, it fills up its attributes. When I try to run this on a
astandalone machine, it works fine but when I try with client server
(Via the browser) it is coming up with AcccessControlException and the
exception looks like the program is trying to write in the client
rather than the server. I want both read and write from the file to
happen at the server.
Please let me know where I am going wrong.

Shekar
 
Reply With Quote
 
 
 
 
Christophe Vanfleteren
Guest
Posts: n/a
 
      04-25-2004
Chandrashekar Tippur wrote:

> All,
>
> I have a serialized object which reads and writes to a file. While it
> reads, it fills up its attributes. When I try to run this on a
> astandalone machine, it works fine but when I try with client server
> (Via the browser) it is coming up with AcccessControlException and the
> exception looks like the program is trying to write in the client
> rather than the server. I want both read and write from the file to
> happen at the server.
> Please let me know where I am going wrong.
>
> Shekar


Any File object works on the *local* filesystem. So for an applet, this is
the client the applet is running on.

You can read from a file on the server as easy as from a local one using an
URL, but writing to it is not that simple. You'll have to use something
like RMI, HTTP Post or FTP.

--
Kind regards,
Christophe Vanfleteren
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      04-25-2004
On 25 Apr 2004 00:37:02 -0700, Chandrashekar Tippur wrote:

> I have a serialized object which reads and writes to a file. While it
> reads, it fills up its attributes. When I try to run this on a
> astandalone machine, it works fine but when I try with client server
> (Via the browser)


An _Applet_?

>...it is coming up with AcccessControlException


Ahh yep. Sounds like an applet.

They need to be jar'd and signed in
order to work through a browser (or
you can mess with policy files - which
is hardly practical for an average
web-surfer)

> ...and the
> exception looks like the program is trying to write in the client
> rather than the server.


Oh wait, you want to write on the _server_..

That can sometimes by done by opening
an URL back to the server of origin,
but I have never seen code that makes
it work.

Another way is to send data back to a
servlet or such that writes the file for you.

Hopefully one of the 'applet upload'
wizards will come along and outline
all the myriad and arcane options..

>..I want both read and write from the file to
> happen at the server.


Reading from the server is easy,
it is the writing that is tricky.

> Please let me know where I am going wrong.


Line 42, column 21. Change the ':' to a ';'. [ ]

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      04-25-2004
On 25 Apr 2004 00:37:02 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) (Chandrashekar Tippur)
wrote or quoted :

> I want both read and write from the file to
>happen at the server.
>Please let me know where I am going wrong.


You are asking us to be mindreaders to guess what is wrong with your
code without seeing it. However, since we have all made many mistakes
in past, we are getting pretty good at it.

See http://mindprod.com/jgloss/fileio.html

I suspect you are using the File methods to write to the local hard
disk. Applets are not permitted to do that without being signed.

THERE IS NO WAY TO DIRECTLY WRITE FILES ON THE SERVER. THERE IS NO
REMOTE FILE I/O IN JAVA. This is not DecNet.

So you have to kludge something up. E.g. an HTTP Get/Put or a raw
socket write or RMI. You need corresponding code on the server to
receive the transmission and store it on disk.

For your options see http://mindprod.com/jgloss/remotefileaccess.html


--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      04-25-2004
On Sun, 25 Apr 2004 07:51:54 GMT, Andrew Thompson
<(E-Mail Removed)> wrote or quoted :

>
>That can sometimes by done by opening
>an URL back to the server of origin,
>but I have never seen code that makes
>it work.


Read but not write. You can do a post, but few servers support that
because it is such a security hole.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
Tony Morris
Guest
Posts: n/a
 
      04-25-2004
"Roedy Green" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Sun, 25 Apr 2004 07:51:54 GMT, Andrew Thompson
> <(E-Mail Removed)> wrote or quoted :
>
> >
> >That can sometimes by done by opening
> >an URL back to the server of origin,
> >but I have never seen code that makes
> >it work.

>
> Read but not write. You can do a post, but few servers support that
> because it is such a security hole.
>
> --
> Canadian Mind Products, Roedy Green.
> Coaching, problem solving, economical contract programming.
> See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.


This all assumes that the URL is using HTTP for the transport mechanism.
Using some other transport protocol, submitting data for write is trivial.

--
Tony Morris
(BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
Software Engineer
IBM Australia - Tivoli Security Software
(2003 VTR1000F)



 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      04-25-2004
On Sun, 25 Apr 2004 10:51:10 GMT, "Tony Morris" <(E-Mail Removed)>
wrote or quoted :

>This all assumes that the URL is using HTTP for the transport mechanism.
>Using some other transport protocol, submitting data for write is trivial.


But that still does not give you access to the file system of the
server. All you can do is talk to some program on the server and
persuade it to use the file system on your behalf.


It is not like the way for example you can use the local file access
methods in Java in Windows to get at files in a shared directory in
another machine on the LAN, just as if they were local.

There are schemes for doing that across the net, e.g. Novell, but Java
does not support them in a platform-independent way. There HAS to be a
much more elaborate security system that you use for intranet.



--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading delimited gzipped serialized objects Dave Brown Java 7 03-10-2006 03:20 PM
Which objects or classes cannot be serialized? 'not serializable' error Will Java 3 02-19-2006 11:27 AM
What java technology for serialized distributed objects? Pep Java 1 08-03-2005 01:25 PM
Error in reading Serialized info Vector objects issues!! rohit Java 2 05-02-2005 04:19 AM
Providing backwards compatibility for serialized objects Jason Mobarak Python 1 07-03-2004 07:40 PM



Advertisments