please see http://hilaltarakci.blogspot.com/2011/03/revisited-using-java-fx-app-in-web.html for background of this post.
Problem
When you build the JavaFX MediaBox component (or a modified version of it), Netbeans 6.9.1 ide produces the following files under
dist
folder.
MediaBox.html
MediaBox.jar
MediaBox.jar.pack.gz
MediaBox.jnlp
MediaBox_browser.jnlp
When you move those files to production environment (some other location or a web server), you may get the following error, when you try to see
MediaBox.html
via a browser.
exception: Connection refused: connect.
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
.....
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.net.ConnectException: Connection refused: connect
Solution
In my case, this was due to
.jnlp
files.Editing
codebase
and homepage
attributes accordingly in both MediaBox.jnlp
and MediaBox_browser.jnlp
files fixed the issue.