Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-04-2007, 04:04 PM
Member
 
Join Date: Dec 2007
Location: MA, USA
Posts: 2
Waccoon is on a distinguished road
Socket refused, but applet talking to native server
Hi, everyone. I've got a real hair-puller on my hands.

I've been having an odd problem with an old applet and socket connections with Java v6. I've read that applets do not need to be signed to connect to servers from which the applet was downloaded. However, since Java v6 was released, some servers have been throwing this permission error:

Quote:
access denied (java.net.SocketPermission <IP ADDRESS>:80 connet, resolve)
This doesn't make sense. If the applet is downloaded from "www.mysite.com" and the applet is trying to open a socket on "www.mysite.com", this shouldn't result in a permission error, should it?

What really confuses me is that this only happens on some servers but not others, which would suggest a server problem, but only Java v6 is causing the applet to complain, so it has to be a client problem (or both). I can't seem to find any real pattern as to which servers will have the issue and which will not. It doesn't seem to make a difference whether the web host is free or commercial.

Code:
URL url = new URL(getCodeBase(), p("url_save", "picture.cgi")); int k = url.getPort(); socket = new Socket(url.getHost(), k <= 0 ? 80 : k);
The code fails on the call for a new socket, so it has nothing to do with writing to the socket. The applet also supports "url.openConnection()" as an alternative, but this also fails with the same SocketPermission error when trying to connect.

The applet is designed to be redistributable, so I do not have a "codebase" defined in my HTML.

I have access to a server that returns the error, so I can test code changes. Is it possible that getCodeBase() can fail in some cases? Does anyone know what might have changed in Java v6 that would suddenly cause this issue to show up, while Java v5 works fine? Is there some special security initialization that needs to happen before a socket is opened? I didn't see anything in the socket tutorials I've been researching.

I know little about Java, but my PHP script is dependent on this applet, so I need to figure out what's wrong. The applet author lives in Japan and I've had no luck contacting him for the last year, so I can't get help that way.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-17-2007, 12:13 PM
Member
 
Join Date: Dec 2007
Location: MA, USA
Posts: 2
Waccoon is on a distinguished road
Possible bug in Java 1.6.0
Well, it appears I've found my answer.

A problem has been discovered in the Firefox version of Java 1.6.0_03

If you know anyone who is having issues with a Java applet using 1.6.0_r3, please let them know about this.

Although only some servers are affected by this issue, I can confirm that all the affected servers I've tested WILL work with Internet Explorer and Opera using the same version of Java. Apparently, only Firefox is affected.

I will also test Safari and Firefox on my old Mac to see if the OSX version of Java has this issue as well.

I guess this will teach me to use different browsers when testing for Java applet compatibility, and not just HTML layout.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
(Server)Socket application deploying mdinant Networking 0 04-09-2008 06:10 PM
Copy a .swf file from server side to client using signed applet Imoracle Java Applets 0 01-28-2008 01:39 PM
Identify Client in Socket Client Server Application masadjie Networking 1 12-20-2007 10:18 AM
Server socket - send image to client Hinty Networking 0 11-30-2007 09:15 PM
Socket Programming (Server) JavaForums Java Blogs 0 11-26-2007 05:00 PM


All times are GMT +3. The time now is 10:39 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org