This question already has answers here:
JavaFX and external JARs
(4 answers)
Closed 6 years ago.
I am having the following exception when launching a Gluon application via webstart... i understand this is not GLUON particle directly related... it seems more a problem with the jar sign.
The Exception:
java.lang.RuntimeException: java.lang.ExceptionInInitializerError
at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.instantiateApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ExceptionInInitializerError
at com.gluonhq.particle.application.Particle.<init>(Particle.java:170)
at com.gluonhq.particle.application.ParticleApplication.<init>(ParticleApplication.java:89)
at mx.gob.scjn.inventario.InventarioAJ.<init>(InventarioAJ.java:22)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter$1.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Toolkit not initialized
at com.sun.javafx.application.PlatformImpl.runLater(Unknown Source)
at com.sun.javafx.application.PlatformImpl.runLater(Unknown Source)
at com.sun.javafx.application.PlatformImpl.setPlatformUserAgentStylesheet(Unknown Source)
at com.sun.javafx.application.PlatformImpl.setDefaultPlatformUserAgentStylesheet(Unknown Source)
at javafx.scene.control.Control.<clinit>(Unknown Source)
... 28 more
I already create my certificates using:
keytool -genkey -keyalg rsa -alias CLS -keystore mykeyStorte
then exporting it:
keytool -export -alias CLS -file rsatest.cer -keystore mykeyStore
I imported into the java control panel and sign the jar using:
jarsigner -keystore mykeyStore InventarioAJ.jar CLS
Obviously I am missing something... ¿Any clue?
Greetings
After getting the answer i got a "duplicate question" mark... but the right answer is not (as i thought) JUST the security/signing part... as a matter of fact the real and important part of the answer has to do with the fact that the Application class can not be cast as an applet and that requiers another change on the JNLP file.
That's right, Java 8 introduces some changes on JavaFX ( i really think this changes were in a later update, but that's not the point).. somehow today the JavaFX Application can't behave like an Applet, so the JNLP file has to look something like:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost/inventarioaj/" href="InventarioAJ.jnlp">
<resources>
<j2se version="1.8+" href=
"http://java.sun.com/products/autodl/j2se"/>
<jar href="/inventarioaj/InventarioAJ.jar" main="true" />
<jar href="lib/controlsfx-8.40.10.jar"/>
<jar href="lib/javax.inject-1.jar"/>
<jar href="lib/particle-1.1.0.jar"/>
<jar href="lib/h2-1.4.191.jar"/>
<jar href="lib/eclipselink.jar"/>
<jar href="lib/javax.persistence_2.1.0.v201304241213.jar"/>
<jar href="lib/org.eclipse.persistence.jpa.modelgen_2.5.2.v20140319-9ad6abd.jar"/>
<jar href="lib/org.eclipse.persistence.jpars_2.5.2.v20140319-9ad6abd.jar"/>
</resources>
<security>
<all-permissions/>
</security>
<application-desc name="Inventario de XXXX"
main-class="mx.xxxxx.InventarioAJ"/>
So the "applet-desc" tag was removed and replaced by the "application-desc" tag and the "security" tag should be in place to allow the application to have access to the file system as well as the network communications.
If that's the case (all permissions needed) then all jars must be signed.
Greetings
Related
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 :-)
I have an enterprise java application that has plenty of jars that are downloaded to the client's jvm cache by a jnlp file. When I start the application I get the following stack trace on Java Console:
Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
at com.sun.deploy.ui.DialogTemplate.imageAvailable(Unknown Source)
at com.sun.deploy.ui.DialogTemplate.finalImageAvailable(Unknown Source)
at com.sun.deploy.ui.ImageLoader$2.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
at com.sun.deploy.ui.DialogTemplate.imageAvailable(Unknown Source)
at com.sun.deploy.ui.DialogTemplate.finalImageAvailable(Unknown Source)
at com.sun.deploy.ui.ImageLoader$2.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
#### Java Web Start Error:
#### The Java security settings have prevented this application from running. You may change this behavior in the Java Control Panel.
My JNLP File is like the following with some censored descriptions:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://10.100.10.9/ikarusdelhitest/" href="ikarus.jnlp">
<information>
<title>ikarus</title>
<vendor>my company</vendor>
<homepage href="http://www.mycompanyaddress.com" />
<description>My enterprise java ee swing application</description>
<icon href="ikarus.jpg" />
<offline-allowed />
</information>
<security>
<all-permissions />
</security>
<resources>
<jar href="jars/ikarus/ikarusClient.jar" />
<jar href="jars/ikarus/ikarusDelegators.jar" />
<jar href="jars/ikarus/clientRules.jar" />
<jar href="jars/ikarus/ruleImps.jar" />
<jar href="jars/ikarus/ikarusUtil.jar" />
<jar href="jars/ikarus/ikarusResources.jar" />
<jar href="jars/ikarus/domain.jar" />
<jar href="jars/ikarus/domain_repository.jar" />
<jar href="jars/ikarus/domain_service.jar" />
<jar href="jars/ikarus/app_repository.jar" />
<jar href="jars/ikarus/app_service.jar" />
<jar href="jars/ikarus/infrastructure.jar" />
<jar href="jars/ikarus/integration_domain.jar" />
<jar href="jars/jboss_ejb_auth/ejb3-persistence.jar" />
<jar href="jars/jboss_ejb_auth/jboss-ejb3x.jar" />
<jar href="jars/jboss_ejb_auth/jbossall-client.jar" />
<jar href="jars/jasper/commons-beanutils-1.8.0.jar" />
<jar href="jars/jasper/commons-collections-3.2.1.jar" />
<jar href="jars/jasper/commons-digester-1.7.jar" />
<jar href="jars/jasper/commons-logging-1.1.jar" />
<jar href="jars/jasper/iText-2.1.0.jar" />
<jar href="jars/jasper/jasperreports-3.6.0.jar" />
<jar href="jars/jasper/poi-3.2-FINAL-20081019.jar" />
<property name="jnlp.localization" value="Delhi"/>
</resources>
<application-desc main-class="com.celebi.ikarus.main.Ikarus" />
ALso note that I get some different exception details on the more information panel:
com.sun.deploy.security.BlockedException: The Java security settings have prevented this application from running. You may change this behavior in the Java Control Panel.
at com.sun.deploy.security.SandboxSecurity.showBlockedDialog(Unknown Source)
at com.sun.javaws.security.AppPolicy.grantUnrestrictedAccess(Unknown Source)
at com.sun.javaws.security.AppPolicy.addPermissions(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.getTrustedCodeSources(Unknown Source)
at com.sun.deploy.security.CPCallbackHandler$ParentCallback.strategy(Unknown Source)
at com.sun.deploy.security.CPCallbackHandler$ParentCallback.openClassPathElement(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$1000(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.SecurityException: Invalid Permissions value: all-permissions
at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
... 39 more
I dont have any security restrictions for security on java control panel. It is at the medium level as follows:
Thanks for any help
New Edit: I got more explanatory stacktrace when I tried to run this jnlp from a jvm 1.6 machine as follows:
java.lang.NoClassDefFoundError: javax/ejb/EJBAccessException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.ejb.EJBAccessException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
I fixed this by going into the Java Control Panel (Start Menu > All Programs > Java > Configure Java) and adding two URLs to the Security Edit Site List.
http://code.google.com
http://androidscreencast.googlecode.com
For Mac System Preferences > Java
Where to add these sites
Java Control Panel > Security Tab > Edit Site List > Add > Apply > Ok
I tried to add the item file:/ and worked.
I recommend you to enable tracing and logging, see here how:
And then run the application from command line.
javaws -verbose AppName.jnlp
Then you could check for clues in log and trace files stored in this path
\Documents and Settings\<USERNAME>\Application Data\Sun\Java\Deployment\log
img source:
http://www.cisco.com/c/en/us/support/docs/security/hostscan/117097-trouble-java7-00.html
I had a very similar problem (Correctly signed JNLP application prevented from running in Java 7)
I fixed it by ensuring
I compiled using 1.7
I updated my JNLP file to enforce 1.7
<resources>
<j2se version="1.7*" java-vm-args="-Xmx32m" max-heap-size="32m" href="http://java.sun.com/products/autodl/j2se"/>
We saw this problem with Java 1.8u60 caused by dead references to icons in the JNLP file. Previously the missing icons were ignored, but now we are seeing failures with the stack trace in the question. Removing the references to the icons fixed our problem.
Here are the two references we removed:
<icon href="ORCL.jpg" kind="splash"/>
<icon href="ORCS.jpg" kind="default"/>
Hope that helps.
You can also try enabling the checkbox under Advanced tab of java (in controlpanel) and check mark the Always allow option under JNLP file section
On an Arch Linux system, I found the Java Control Panel to be accessible at /opt/java7/jre/bin/ControlPanel (a symlink to jcontrol). By running it, I was able to access the Security tab, and then crank down the Security Level to Medium. Then I'm prompted about accepting a security warning upon starting something like /opt/java7/bin/javaws.
I have created a JNLP to load the applet and some native DLL files. Following are the codes of each components
JNLP
<?xml version="1.0" encoding="UTF-8"?>
<!-- href attribute contains relative path;
codebase attribute not specified -->
<jnlp href="myKad.jnlp">
<information>
<title>MyKad Reader Applet</title>
<vendor>MyKad</vendor>
</information>
<security>
<all-permissions/>
</security>
<resources>
<!-- Application Resources -->
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" />
<jar href="HLB_Mykad-0.0.1-SNAPSHOT.jar" main="true"/>
<nativelib href="HLB_Mykad-0.0.1-SNAPSHOT.jar" download="eager"/>
</resources>
<applet-desc
name="MyKad Applet"
main-class="com.glexim.applet.GleximApplet"
width="1"
height="1">
</applet-desc>
<update check="background"/>
</jnlp>
JAR (HLB_Mykad-0.0.1-SNAPSHOT.jar) Structure (JAR's are Packaged at top lavel)
com.glexim.applet.GleximApplet
META-INF
Sample.dll
HTML Code
<applet jnlp_href="./applet/myKad.jnlp"
code="com.glexim.applet.GleximApplet" id="gleximApplet"
mayscript="true" width="0px" style="" />
While loading applet I am getting following exception in applet console:
java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: no Sample in java.library.path
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: no Sample in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.glexim.zf1.MyKad$1.run(MyKad.java:19)
at java.security.AccessController.doPrivileged(Native Method)
at com.glexim.zf1.MyKad.<clinit>(MyKad.java:13)
at com.glexim.applet.GleximApplet.<init>(GleximApplet.java:43)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: no Sample in java.library.path
My Applet is signed applet and all the DLL files inside applet are also signed with same signature.
Create other section in your JNLP file describing the native resources:
<resources os="Windows" arch="x86">
<nativelib href="jar-with-nativelibs.jar"/>
</resources>
(You don't have to use one jar for each os and architecture supported, but it's recommended)
And after that, define the java.library.path property:
<property key="java.library.path" value="." />
And you're good to go.
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"/>
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.myappApplication"/
</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.