Java web start - Unable to load resource - java

I've got a jar that loads great with java web start when I browse through the IP address of the server.
Once I try the server name instead I get the following exception:
com.sun.deploy.net.FailedDownloadException: Unable to load resource:
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)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(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)
The wrapped exception:
java.io.FileNotFoundException:
at sun.reflect.GeneratedConstructorAccessor2.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doGetRequest(Unknown Source)
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)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(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)
Caused by: java.io.FileNotFoundException:
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
... 15 more
JNLP:
<?xml version="1.0" encoding="utf-8"?>
<jnlp
spec="1.0+"
codebase="http://servername/Site/Views/.."
href="">
<information>
<title>title</title>
<vendor>vendor</vendor>
<description>description</description>
<description kind="short">short</description>
<icon href="../../icon.gif" />
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.5+" java-vm-args="-Xmx1000M -Xms150M" initial-heap-size="150M" max-heap-size="1000M" />
<j2se version="1.4.2+" href="http://java.sun.com/products/autodl/j2se" java-vm-args="-Xmx1000M -Xms150M" initial-heap-size="150M" max-heap-size="1000M" />
<jar href="/file.jar"/>
</resources>
<application-desc main-class="com....">
<argument>CD6B172DEC34924D83EA64A61A6550BE1271325929392</argument>
<argument>http://servername/file.asp</argument>
<argument>/Site</argument>
</application-desc>
</jnlp>
Any idea what should I look for?

I've changed the java proxy settings to direct connection - and it works.

Try using Janela or github to diagnose the problem.

Include your IP address in your host file (C:\Windows\System32\drivers\etc\host) for the respective server:
Sample Entry:
10.100.101.102 server1.us.vijay.com Vijay's Server

I'm not sure exactly what the problem is, but I have looked at one of my jnlp files and I have put in the full path to each of my jar files. (I have a velocity template that generates the app.jnlp file which places it in all the correct places when my maven build runs)
One thing I have seen happen is that the jnlp file is re-downloaded by the by the webstart runtime, and it uses the href attribute (which is left blank in your jnlp file) to re-download the file. I would start there, and try adding the full path into the jnlp files too...I've found webstart to be a fickle mistress!

If anyone else gets here because they're trying to set up a Jenkins slave, then you need to set the url of the host to the one it's actually using.
On the host, go to Manage Jenkins > Configure System and edit "Jenkins URL"

i got the same issue, i updated the hosts file with the server address and it worked

changing java proxy settings to direct connection did not fix my issue.
What worked for me:
Run "Configure Java" as administrator.
Go to Advanced
Scroll to bottom
Under: "Advanced Security Settings" uncheck "Use SSL 2.0 compatible ClientHello format"
Save

this also worked for me , thanks a lot
changing java proxy settings to direct connection did not fix my issue.
What worked for me:
Run "Configure Java" as administrator.
Go to Advanced
Scroll to bottom
Under: "Advanced Security Settings" uncheck "Use SSL 2.0 compatible ClientHello format"
Save

In Advance Tab -> scroll down and un-checked all options in advance security setting and try by checking one-by-one and finally app start running with one option TLS 1.1
that was the solution I got it.

Related

Apache Tomcat home page not coming

I installed Apache server (Tomcat 7.63) on client machine (Window 7 system 32 bit), The Java version used in client machine is (JDK 1.8 update 60)
Problem
Tomcat server is started by running the file (...\bin\Tomcat7.exe). But when I tried to open the home page (http://localhost:8080/) it is not coming on browser and I can see the following exception on Apache log:
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler process
SEVERE: Error reading request, ignored
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at sun.nio.cs.AbstractCharsetProvider.lookup(Unknown Source)
at sun.nio.cs.AbstractCharsetProvider.access$000(Unknown Source)
at sun.nio.cs.AbstractCharsetProvider$1.next(Unknown Source)
at sun.nio.cs.AbstractCharsetProvider$1.next(Unknown Source)
at java.nio.charset.Charset.put(Unknown Source)
at java.nio.charset.Charset.access$200(Unknown Source)
at java.nio.charset.Charset$3.run(Unknown Source)
at java.nio.charset.Charset$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.nio.charset.Charset.availableCharsets(Unknown Source)
at org.apache.tomcat.util.buf.B2CConverter.<clinit>(B2CConverter.java:51
)
at org.apache.tomcat.util.buf.ByteChunk.<clinit>(ByteChunk.java:102)
at org.apache.tomcat.util.buf.MessageBytes.<init>(MessageBytes.java:58)
at org.apache.tomcat.util.buf.MessageBytes.<init>(MessageBytes.java:36)
at org.apache.tomcat.util.buf.MessageBytes$MessageBytesFactory.newInstan
ce(MessageBytes.java:685)
at org.apache.tomcat.util.buf.MessageBytes.newInstance(MessageBytes.java
:78)
at org.apache.coyote.Request.<init>(Request.java:83)
at org.apache.coyote.AbstractProcessor.<init>(AbstractProcessor.java:61)
at org.apache.coyote.http11.AbstractHttp11Processor.<init>(AbstractHttp1
1Processor.java:273)
at org.apache.coyote.http11.Http11Processor.<init>(Http11Processor.java:
56)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.creat
eProcessor(Http11Protocol.java:165)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.creat
eProcessor(Http11Protocol.java:103)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:586)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoin
t.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh
read.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at sun.nio.cs.CharsetMapping.load(Unknown Source)
at sun.nio.cs.CharsetMapping$1.run(Unknown Source)
at sun.nio.cs.CharsetMapping$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.nio.cs.CharsetMapping.get(Unknown Source)
at sun.nio.cs.ext.SJIS_0213$1.run(Unknown Source)
at sun.nio.cs.ext.SJIS_0213$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.nio.cs.ext.SJIS_0213.<clinit>(Unknown Source)
... 30 more
Exception in thread "http-bio-8085-exec-1" java.lang.NullPointerException
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:731)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoin
t.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh
read.java:61)
at java.lang.Thread.run(Unknown Source)
What is really weird to me that if I start Apache server from Services Management Console from the administrator account: Administrative Tools -> Services , it is working fine and I can see that the home page (http://localhost:8080/) is coming on browser.
Question
Why Apache home page is not coming if we run Apache server using the .exe file (...\bin\Tomcat7.exe) ? Why the home page is coming if the server started using Windows service ? In both cases the same .exe file is execute to run the server, what is the difference between the two cases ?
Tomcat cannot be started by using the exe directly (unless the correct parameters are supplied), you should use one of the included .bat files if you want to do that: startup.bat
Just be sure to define your environment variables, such as JAVA_HOME, and/or JRE_HOME

Trying to open a JNLP that specifies an older version of Java (1.6+) but the browser forces user to download current version of Java

I have the following JNLP file:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="h_t_t_p_s://xxx.com/yyy/" href="yyy.jnlp">
<information>
<title>My Title</title>
<vendor>My Company</vendor>
<homepage href="h_t_t_p_s://xxx.com/yyy"/>
<description>A description</description>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.6+"
href="h_t_t_p://java.sun.com/products/autodl/j2se"/>
<jar href="h_t_t_p_s://xxx.com/yyy/yyy.jar" main="true" />
</resources>
<application-desc
main-class="com.xxx.yyy.MainClass">
</application-desc>
</jnlp>
It works find if you have the current version of Java (currently 1.8 or on Ubuntu if you have 1.7 because it is the most recent version of openjdk.)
However, on Firefox or Internet Explorer on Windows 7 with Java 1.7, it forces you to install Java 1.8.
If I download the jnlp file and try to run it, you get a warning about the version, but the launch fails with:
javax.net.ssl.SSLHandshakeException: com.sun.deploy.security.RevocationChecker$StatusUnknownException
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at sun.security.ssl.Handshaker.process_record(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at com.sun.deploy.net.HttpUtils.followRedirects(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.checkUpdateAvailable(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.isUpdateAvailable(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.javaws.Launcher.updateFinalLaunchDesc(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main.access$000(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com.sun.deploy.security.RevocationChecker$StatusUnknownException
at com.sun.deploy.security.RevocationChecker.checkCRLs(Unknown Source)
at com.sun.deploy.security.RevocationChecker.check(Unknown Source)
at com.sun.deploy.security.RevocationCheckHelper.doRevocationCheck(Unknown Source)
at com.sun.deploy.security.RevocationCheckHelper.doRevocationCheck(Unknown Source)
at com.sun.deploy.security.RevocationCheckHelper.checkRevocationStatus(Unknown Source)
at com.sun.deploy.security.X509TrustManagerDelegate.checkTrusted(Unknown Source)
at com.sun.deploy.security.X509Extended7DeployTrustManagerDelegate.checkServerTrusted(Unknown Source)
at com.sun.deploy.security.X509Extended7DeployTrustManager.checkServerTrusted(Unknown Source)
... 28 more
I am hoping to deploy with a required version of 1.6+ so that users don't have to update their java just for me.
a JNLP that specifies an older version of Java
No it doesn't. 1.6+ specifies Java 1.6 or later.
If you want exactly 1.6, remove the +.
I am hoping to deploy with a required version of 1.6+ so that users don't have to update their java just for me.
Actually, you are doing your users a big favor if you force them to upgrade their Java.
Both Java 6 & Java 8 have been EOL'ed and the last publicly available builds will probably have exploitable security flaws. This is why Firefox and Internet Explorer are making a fuss about running Java via the Java plugin.
As for the problem with CRL check failing, I think it might be this bug:
http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8020390
If so, the fix is to upgrade the Java installation :-)

Java webstart on glassfish server 4.1

I'm building an application on Glassfish 4.1. The application is a Rest API. For the client part, I have created a java JFrame class with a number of classes underlying to use the Rest API using Jaxb. Lots to do still but that's off topic.
I'm using Netbeans for the development. For testing my JFrame class, I simply run it from out of Netbeans (Select class, menu Run > Run File). I want to take it a step further though and deliver the client application by means of java webstart. I use other apps which also do this and I think it is a neat way to deliver your java gui to a client (alternatives welcome?). Maybe I'll go to a browser based solution later but that's not a goal in the near future.
Now the webstart. I have tried 2 methods:
following the java tutorials: https://docs.oracle.com/javase/tutorial/deployment/webstart/index.html
Within the project of my Rest API, I created an index.html file containing the following line:
<script>
deployJava.launchWebStartApplication("launch.jnlp")
</script>
Then the launch.jnlp:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="http://<hostname>:8080/" href="launch.jnlp" spec="1.0+">
<information>
<title>ClientTool</title>
<vendor>Bla</vendor>
<homepage href=""/>
<description>Bla</description>
<description kind="short">Bla</description>
<icon href="bla.png" kind="default"/>
<offline-allowed/>
</information>
<update check="background"/>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.7+"/>
<jar href="ClientTool.jar" main="true"/>
</resources>
<application-desc main-class="gui.ClientFrame">
</application-desc>
</jnlp>
I have deployed this, the index.html opens and starts the launch.jnlp. So far so good, but not really:
com.sun.deploy.net.FailedDownloadException: Unable to load resource: http://<hostname>:8080/ClientTool.jar
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.downloadResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Makes sense because I don't have a Jar file explicitly created. I obviously need to do this, but how? Must I create a seperate project in NetBeans to create the JAR? And where to put it exactly on the glassfish host?
by creating a new project in Netbeans, type Enterprise application client.
This works really well, You get a webstart out of the box, deploy it on glassfish and you're done. Well not really, because since Java 7 21, security has been enhanced and the way Glassfish creates the webstart config, it does not work.
See following threads for this issue. It is a reported bug but nog handled since months. And the alternative to use a lower version than Java 7 21 is simply not ok imo. Version 7 cannot even be downloaded anymore.
Signed Java web start application with Glassfish 4.1 and Java7
https://java.net/jira/browse/GLASSFISH-21305
Still investigating a bit further on what is going wrong exactly, the following trace was what I found:
java.lang.SecurityException: JAR manifest codebase mismatch for http://<hostname>:8080/___JWSappclient/___app/ClientGUI/ClientGUIClient.jar
at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
at com.sun.javaws.security.AppPolicy.grantUnrestrictedAccess(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
at com.sun.javaws.Launcher.prepareResources(Unknown Source)
at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main.access$000(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
So apparently glassfish is doing something wrong with the codebase config.
Any thoughts please on how to get Glassfish and Java webstart to work?
Sapphron

Java Web Start Jar signing Issue?

I'm trying to run this Java application (jar) via Java Web Start and am having an incredibly difficult time.
Here's my current JNLP source:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/" href="Test.jnlp">
<information>
<title>Jnlp Testing</title>
<vendor>YONG MOOK KIM</vendor>
<homepage href="http://localhost:8080/" />
<description>Testing Testing</description>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.6+" />
<jar href="TestJnlp.jar" />
<jar href="lib/appframework-1.0.3.jar"/>
<jar href="lib/junit-4.7.jar"/>
<jar href="lib/org.eclipse.swt.win32.win32.x86_64_3.100.0.v4233d.jar"/>
<jar href="lib/org-netbeans-modules-java-j2seproject-copylibstask.jar"/>
<jar href="lib/sqlite-jdbc-3.7.2.jar"/>
<jar href="lib/swing-worker-1.1.jar"/>
</resources>
<application-desc main-class="proteotypic.ProteotypicQuantificationApp" />
</jnlp>
Upon running the JNLP file, I get the following Error:
JNLPException[category: Launch File Error : Exception: null : LaunchDesc:
---- here the JNLP ----
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
at com.sun.javaws.Launcher.prepareResources(Unknown Source)
at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I have signed all the jars except lib/org.eclipse.swt.win32.win32.x86_64_3.100.0.v4233d.jar - if I sign that one too, I get a different exception:
com.sun.deploy.net.FailedDownloadException: Unable to load resource: http://localhost:8080/lib/org.eclipse.swt.win32.win32.x86_64_3.100.0.v4233d.jar
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)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.io.IOException: invalid SHA1 signature file digest for org/eclipse/swt/awt/SWT_AWT$4.class
at com.sun.deploy.cache.CacheEntry$9.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.cache.CacheEntry.writeFileToDisk(Unknown Source)
at com.sun.deploy.cache.Cache.downloadResourceToTempFile(Unknown Source)
at com.sun.deploy.cache.Cache.downloadResourceToCache(Unknown Source)
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)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
After doing "javaws -viewer" and re-running the JNLP, I get:
https://gist.github.com/3183636
You have to sign the jar file. You can do this yourself using keytool, but if you plan on deploying this, I would recommend getting it signed by Verisign or a company like it.
If you just need a temporary fix, signing it yourself for testing is fine.
Here is an easy to use tutorial.
All jars must be signed with the same signature.
All jars in one jnlp need to be signed with the same signature, use an extension with its own jnlp for jars that are signed by third parties.
Some jars use the original signature in the jar for crypto (the JDBC driver for SQL server) others do not work when re-signed (javahelp.jar)
You can also save the trouble signing them by including this in your application's jnlp:
<extension name="javahelp" href="javahelp.jnlp"/>

Use Java web start to start application on the command line by the file name

I can use Java web start to start my Swing GUI application on the command line by the url with jdk 6 & Windows XP:
javaws http://localhost:7001/webstart/myapp/launch.jnlp
How to use Java web start to start my Swing GUI application on the command line by the file name?
The following ways do not work:
javaws -codebase '' launch.jnlp
java.net.MalformedURLException: no protocol: ''
at java.net.URL.(Unknown Source)
at java.net.URL.(Unknown Source)
at java.net.URL.(Unknown Source)
at com.sun.javaws.Main.parseArgs(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
javaws -codebase "" launch.jnlp
java.net.MalformedURLException: unknown protocol: c
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at com.sun.javaws.Main.parseArgs(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
javaws -codebase "file:." launch.jnlp
com.sun.deploy.net.FailedDownloadException: Unable to load resource: file:./$$name
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)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.Launcher.updateFinalLaunchDesc(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
javaws -codebase "file:." file://launch.jnlp
CouldNotLoadArgumentException[ Could not load file/URL specified: file://launch.jnlp]
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
javaws file://launch.jnlp
CouldNotLoadArgumentException[ Could not load file/URL specified: file://launch.jnlp]
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
#The following has no error message, but nothing appear on the computer screen:
javaws -codebase "" -J-Xrunjdwp:transport=dt_socket launch.jnlp
javaws -J-Xdebug -J-Xnoagent -J-Xrunjdwp:transport=dt_socket,server=n,suspend=y launch.jnlp
javaws -codebase "" -J-Xrunjdwp:transport=dt_socket,server=n,suspend=n launch.jnlp
javaws -codebase "" -J-Xrunjdwp:transport=dt_socket,server=y,suspend=n launch.jnlp
The launch.jnlp file is as follows:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="$$codebase" href="$$name">
<information>
<title>${com.prod.my.myapp.common.client.title}</title>
<vendor>I</vendor>
<homepage href="http://devzone/english/dev%20template/html_templates/main.asp"/>
<description>${com.prod.my.myapp.common.client.description}</description>
<description kind="short">${com.prod.my.myapp.common.client.short_description}</description>
<icon href="$$context/images/chflag.jpg"/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<java version="1.6.0_05" href="http://java.sun.com/products/autodl/j2se" max-heap-size="256m"/>
<!-- myapp Application -->
<jar href="myprod.myapp.client.jar"/>
<jar href="myprod.reports.jar"/>
<!-- TR Client jar -->
<jar href="extern.ejb-client.jar"/>
<property name="java.naming.factory.initial" value="weblogic.jndi.WLInitialContextFactory"/>
<property name="java.naming.provider.url" value="${com.prod.my.myapp.common.client.naming_provider}"/>
<property name="weblogic.jndi.enableServerAffinity" value="true" /
</resources>
<application-desc main-class="com.prod.my.myapp.common.framework.applicationmainwindow.gui.myappAp­plication"/
</jnlp>
Try a codebase value of..
"file:."
It seems your JNLP file should be used together with the JNLPDownloadServlet. It replaces the $$name and $$codebase palceholders with the current values based on the server where you application currently runs. (Btw. you can also use $$server to refer the current server)
If you run it locally from disk, you can overwrite the codebase by setting it on the command line as parameter -codebase. The right value is file:.. You problem is that the $$name placeholder is not replaced and it tries do download the <jnlp ... href="$$name"> which results to file:.$$name and since no such file exists it fails.
You can either completely omitt the href="$$name" attribute in the <jnlp /> tag when running locally or manually change it to the jnlp file name e.g. <jnlp ... href="myApp.jnlp" />.
Also remeber if you want to use some local jar stored on you disk and you want to refer it via absolute path you should use this format <jar href="file:c:/myJars/myJar.jar"> (forward slashes).
All the best.

Categories

Resources