This discussion is archived
5 Replies Latest reply: Dec 17, 2012 4:03 AM by gimbal2 RSS

Applets from a local http server don't load

978934 Newbie
Currently Being Moderated
I am using Java7 SDK to compile my Java Applet Code. Same code was perfectly working with Java1.6 JDK and JRE1.6 update 37.
But it stops working when I compile my code with Java7 SDK and on JRE 1.7 update 9.
After spending lot of time I found a bug posted in Oracle site @ http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7184280 which states :
With JRE 1.7, in a local network the communication is in IPv6 and there is a problem in the java code of the JRE which makes that in
this case the applets don't load.

For a workaround we need to add the parameter "-Djava.net.preferIPv4Stack=true" in HTML applet tag.

+<Applet+

style = "position:absolute;border:0px;left:184;top:95;height:180;width:364;"
code = "jtreeviewapplet.JTreeViewAppletMain.class"
name = "TreeView"
id = "TreeView"
hspace = "0"
vspace = "0"
align = "top"
archive = "/Project/HTML/ABC/XYZ.jar,/Project/HTML/ABC/ABC.jar"
MAYSCRIPT>

*+<PARAM NAME="java_arguments" VALUE="-Djava.net.preferIPv4Stack=true">+*
+<PARAM NAME="onSelected" VALUE="onSelect_Handler">+
+<PARAM NAME="onFinishNormalize" VALUE="onFinishNormalize_Handler">+
+</Applet>+

Now after putting this paramete it works.
But the problem here is that we are forcing our client to use IPV4 and we have to do all such changes in all the html file wherever it is applicable.
There are almost 1245 html files , in which we are using applet tag and we have to put this parameter <PARAM NAME="java_arguments" VALUE="-Djava.net.preferIPv4Stack=true"> everywhere in the html.

My questions are:
1) Is this really a java bug?
2) Do we need at all this parameter(-Djava.net.preferIPv4Stack=true) to run our applet.
3) what is the solution to get rid from this problem? I think all this stuff should be handled from java side. Becuase with Java 6 everythings are running.

Could anybody suggest what to do, it would be a great help.
  • 1. Re: Applets from a local http server don't load
    sabre150 Expert
    Currently Being Moderated
    975931 wrote:
    I am using Java7 SDK to compile my Java Applet Code. Same code was perfectly working with Java1.6 JDK and JRE1.6 update 37.
    But it stops working when I compile my code with Java7 SDK and on JRE 1.7 update 9.
    Are you sure? This sounds more like a runtime bug than a compile time bug!

    <snip/>
    Could anybody suggest what to do, it would be a great help.
    Which ever web server you are using will have some way of applying filters so just write a filter that looks for the Applet tag and inserts whatever you need.
  • 2. Re: Applets from a local http server don't load
    EJP Guru
    Currently Being Moderated
    1) Is this really a Java bug?
    No. Look closer. The bug is closed as a duplicate of another bug, which in turn is closed as not reproducible:
    EVALUATION

    The issue is not reproducible too. This could be a firewall issue or some network configuration issue on the host machine/router.
    2) Do we need at all this parameter(-Djava.net.preferIPv4Stack=true) to run our applet.
    No. There is no evidence in the original bug that IPv6 was being used at all. All the IP addresses logged are IPv4 addresses. See the Evaluation.

    In other words this is not the solution to your problem: or at least there isn't enough evidence here to justify rewriting 1245 HTML files, even mechanically.
  • 3. Re: Applets from a local http server don't load
    jtahlborn Expert
    Currently Being Moderated
    EJP wrote:
    1) Is this really a Java bug?
    No. Look closer. The bug is closed as a duplicate of another bug, which in turn is closed as not reproducible:
    actually, the linked issue 7183450, is still open (although the evaluation says it is not reproducible).
  • 4. Re: Applets from a local http server don't load
    978934 Newbie
    Currently Being Moderated
    If this is not a bug, why after putting this one line +(<PARAM NAME="java_arguments" VALUE="-Djava.net.preferIPv4Stack=true">)+ of code within APPLET tag everything works fine. Why this parameter is being exposed by Java?
    If there would have been ever a problem with network issues with the host machine then thing should not work as well with JRE 1.6 and all its updates. This is happening only with JRE 1.7 and its update.

    Right, there is no evidence but why it is not working is my question? What should I go a check for? Is there some thing I really need to change in my java applet code to make it work?

    Edited by: 975931 on Dec 17, 2012 3:50 AM

    Edited by: 975931 on Dec 17, 2012 4:05 AM
  • 5. Re: Applets from a local http server don't load
    gimbal2 Guru
    Currently Being Moderated
    975931 wrote:
    If this is not a bug, why after putting this one line +(<PARAM NAME="java_arguments" VALUE="-Djava.net.preferIPv4Stack=true">)+ of code within APPLET tag everything works fine. Why this parameter is being exposed by Java?
    If there would have been ever a problem with network issues with the host machine then thing should not work as well with JRE 1.6 and all its updates. This is happening only with JRE 1.7 and its update.

    Right, there is no evidence but why it is not working is my question? What should I go a check for? Is there some thing I really need to change in java code?
    That has nothing to do with applets specifically. Its a parameter which forces Java to prefer IPv4 where it normally prefers IPv6. If that isn't working properly its more a problem of your machine, not Java. Java 6 happened to prefer IPv4 which is why it worked, but Java 7 is of course prepared for the very near future; I would take the hint you're getting here and investigate what you need to do to make your network IPv6 ready.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points