• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 648
  • Last Modified:

applet connection refused exception


i've had this applet that worked perfectly for years.  until i changed JRE from 1.4.1_01 to 1.4.1_02.  the applet is AppletButton.class that can be gotten from the java site.  currently, it gets as far as showing a button on the web page which when clicked opens a frame in a new window.  and then it shows the error "Exception: Connection refused: connect"

searched the net but the hits i'm getting are pertaining to database connections.  no database is involved in my little app.

i'm using IE 5.5 on Windows 2000.  Tools-Advanced has the "Use Java 2v1.4.1_02 for <applet>(requires restart)" checkbox selected.  

the registry says that the CurrentVersion of JRE is 1.4. and HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment contains folders 1.4 and 1.4.1_02.  both folders have:

   JavaHome  = C:\Program Files\Java\j2re1.4.1_02
   RuntimLib = C:\Program Files\Java\j2re1.4.1_02\bin\client\jvm.dll

and those folders and files exist.  so i think the setup is okay.  i don't like mucking around in this windows registry and haven't tried removing the 1.4 folder and changing the CurrentVersion.  haven't had the need to do that before when updating JREs.

also tried it with Opera 7--the button does not even show up.

i've tried going back to j2re.1.4.1_01, that doesn't work anymore.  i'm not sure how to start fixing this.  would appreciate any pointer/direction.

  • 4
1 Solution
can u post the stack trace for the exception.
It sounds like you are trying to open a connection to a site other than the one the applet was loaded from (or at least the jre thinks so). Check the hostname you are using to connect is identical to the hostname of the url the applet was loaded from.

Maybe best to actually use the hostname from the codebase or document base:
String host = applet.getCodeBase().getHost();

If the problem is related to a problem with your JRE installation, then I would suggest removing all JRE's and reinstall 1.4.1_02.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Couple of things you could consider:
1) I was told before that the JRE of 1.4.X might not work properly sometimes with IE 6 below, so first thing you might try is to update your IE version to latest IE, which is probably 6 Service Pack 1.

2) You don't have to muck around the Windows Registry. Instead, try to run the Applet with an Applet viewer or something like that in some IDEs, such as JBuilder. If it is visible without any problem, it would further prove that it was the browser plug-in problems.

3) When you switch around different version of JREs (i.e. from 1.3.X to 1.4.X), you might need to restart it in order for the browser to pick it up.

4) Better use the JRE 1.3.05, which I once tested to work most of my complicated Applet programs, even the ones written in Swing.
akeimouAuthor Commented:
oops!  i forgot about that one (embarrassed smiley here).

i had a static URL in there.  moved the app to a different server.  then the old server shut down.  just about the same time i upgraded my JRE.  i wouldn't have been able to find that for a long time as my focus was on the JRE.  thanks!

so it works in IE now.  still no go with Opera.  i think the problem there is my HTML code for the applet which is geared towards IE and Netscape only.  i don't know if Opera also needs special treatment but tomorrow's another day...
We all get caught up like that occasionally.
Good to hear your back on track.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now