Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

Problems starting applet in browser

Thread view: 
MiranL@gmail.com - 05 May 2006 12:47 GMT
Hello!

My code:
InputStream in = null;
URL url = new URL("http://my.url:80/myfile");
URLConnection connection = url.openConnection();
in = connection.getInputStream();

ObjectInputStream ois = new ObjectInputStream(in);
vFile = (Vector) ois.readObject();                    // error

When i run this code in appletviewer i get no errors, but in browser in
get this message: access denied (Java.lang.RuntimePermission
accessClassInPackage.sun.swing)

In there any way to solve this problem without dig. signing the applet?
Or perhaps to use some alternative to ois.readObject()...
Niels Dybdahl - 05 May 2006 13:00 GMT
> Hello!
>
[quoted text clipped - 12 lines]
>
> In there any way to solve this problem without dig. signing the applet?

It is possible without signing if your applet is started from the same
server. If the applet is started from somewhere else, it will not work.
If you use getCodeBase() instead of a hardcoded path, then you ensure that
the server is exactly the same.

Niels Dybdahl
MiranL@gmail.com - 05 May 2006 15:28 GMT
The problem is not in the connection between server and client but in
this line:
(Vector) ois.readObject();
Oliver Wong - 05 May 2006 18:37 GMT
> The problem is not in the connection between server and client but in
> this line:
> (Vector) ois.readObject();

   Regardless of where the exception is thrown, one of the restrictions for
unsigned applets is that you cannot connect to any server except the one
from which the applet is downloaded from. So when you're running this applet
within your browser, is the applet being downloaded from http://my.url:80/ ?

   - Oliver
Andrew T. - 06 May 2006 03:53 GMT
...
> URL url = new URL("http://my.url:80/myfile");
> URLConnection connection = url.openConnection();
...
> When i run this code in appletviewer i get no errors, but in browser in
> get this message: access denied (Java.lang.RuntimePermission
> accessClassInPackage.sun.swing)

As you should.

> In there any way to solve this problem without dig. signing the applet?

If you find one please let us know, so we can get Sun
to issue a patch for it.

Andrew T.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.