Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JNLP Error

 
Malcolm Grayson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having trouble with running my java application from the jnlp. The jnlp and the jar it is refering to are in the same directory (c:\home\jnlp_test\). The jnlp error is:

java.lang.ClassNotFoundException: spool.client.Main
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 com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

The troubling part is that I can verify that the Main.class IS in the spool.jar. Furthermore I can run spool.jar from a batch file without problem. This leads me to believe that the error is with the jnlp itself.

Here is the jnlp file:

<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for Application -->
<jnlp spec="1.0+"
codebase="file://localhost/c:/home/jnlp_test"
href="spool.jnlp">
<information>
<title>Spool Tool Application</title>
<vendor>M.Grayson</vendor>
<homepage href="../rail/Index.html"/>
<description>AD HOC QUERY TOOL</description>
<description kind="short">2.0 Spool Tool</description>
<icon href="crossbuck.jpg"/>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.4"/>
<jar href="file://localhost/c:/home/jnlp_test/spool.jar"/>
<jar href="http://MyServer/lib/jacob.jar"/>
<jar href="http://MyServer/lib/jxl.jar"/>
<jar href="http://MyServer/lib/classes12.jar"/>
</resources>
<resources>
<os="Windows"/>
<nativelib href="http://MyServer/lib/jacob_dll.jar"/>
</resources>
<application-desc main-class="spool.client.Main"/>
</jnlp>

I'm stumped! Can anyone shed some light onto this problem. Thanks in advance. Cheers!
 
Ravikanth kolli
Ranch Hand
Posts: 179
Chrome Eclipse IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the problem is with the jar file declaration



We should have just spool.jar rather than the complete path for the file. I too had similar problems and i found out that href actually tries to locate the file based on the codebase that is intially specified. So i think just mentioning spool.jar would help.



And also a "/" within the codebase something like
since we are refering to a directory and we are using as a base directory for all the other references.

Hope this helps.
thanks
 
Malcolm Grayson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. I adjusted my code as you suggested, but the error still remains.
 
Ravikanth kolli
Ranch Hand
Posts: 179
Chrome Eclipse IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As there are multiple jar declarations we should specify which one if it is the main jar that has the main file. So we need to specify something like this to spool.jar




Think this one does the trick..

Thanks
 
Paresh Wankhede
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
keep the entry of your source jar as the lastr entry as given below.

This should help you out.

<resources>
<j2se version="1.4"/>
<jar href="./lib/jacob.jar"/>
<jar href="./lib/jxl.jar"/>
<jar href="./lib/classes12.jar"/>
<jar href="./spool.jar"/>
</resources>

.. Paresh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic