Connection refused an exception when trying to start the jar via web start

I get the following exception when trying to start jar via java web start:

com.sun.deploy.net.FailedDownloadException: Unable to load resource: http://localhost   /ValidatorWEB/validator.jnlp
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)

This is a wrapped exception:

java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)

Here is my .jnlp file:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost/ValidatorWEB/" 
href="validator.jnlp">
<information>
    <title>Validator</title>
    <vendor>My Company</vendor>
</information>
<resources>
    <!-- Application Resources -->
    <j2se version="1.6+"
          href="http://java.sun.com/products/autodl/j2se"/>
    <jar href="WEB-INF/lib/validator.jar" main="true" />

</resources>
<application-desc
     name="Validator"
     main-class="webstartComponentArch.DynamicTreeApplication"
     width="300"
     height="300">
 </application-desc>
 <update check="background"/>

I am deploying all this as a simple WAR for Glassfish v2.1 on my local machine. Validator.jar is in WEB-INF / lib, and the jnlp and jsp page that I access jnlp is in the root of the ValidatorWEB folder.

Google did not help. I tried disabling the firewall and it still does the same. I have a matching set of Mime type in Glassfish. Is there anything else I forgot to do?

+3
source share
5 answers

So, I figured it out. The problem was where I specify the base url:

<jnlp spec="1.0+" codebase="http://localhost/ValidatorWEB/" href="validator.jnlp">

Glassfish, URL-, -, :

http://localhost:8080/ValidatorWEB/

, :

<jnlp spec="1.0+" codebase="http://localhost:8080/ValidatorWEB/" href="validator.jnlp">

, .

!

+1

, http://localhost? -, localhost 80. Localhost == 127.0.0.1 == .

Webstart aka JNLP- , - () . . URL-, - , webapp, JNLP.

+1

localhost - , -, - ?

wget ting ( ) URL- jnlp? , , Java .

0

I don’t know if this is related to this, but, indicating the address of the jar resource, I would not use "WEB-Δ±NF / lib", the client machine could not see inside web-inf, you should not put this jar in a web application not inside web inf.

0
source

Source: https://habr.com/ru/post/1724745/


All Articles