0

We are migrating from Applet to JWS. How to provide dependent jar to JWS? Kindly check my JNLP file.

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/JWSINSTEADOFAPPLET/" href="HelloWorld.jnlp">
<information>
         <title>HelloWorld</title>
         <vendor>IBM - JWS example of HelloWorld</vendor>`
    enter code here
         <description>HelloWorld - Example of JWS</description>
         <description kind="short">HelloWorld example</description>
         <offline-allowed/>
    </information>
    <security>
    <all-permissions/>
</security>
    <resources>
     <j2se version="1.3+"/>
     <jar href="Harper_Colin.jar" main="true"/>
     <jar href="lib/commons-codec-1.10.jar"/>
     <jar href="lib/commons-httpclient-3.1.jar"/>
     <jar href="lib/commons-logging-1.2.jar"/>
     <jar href="lib/commons-net-3.3.jar"/>
     <jar href="lib/httpclient-4.0.2-sources.jar"/>
     <jar href="lib/httpclient-4.5.3.jar"/>
     <jar href="lib/httpcore-4.4.6.jar"/>
     <jar href="lib/plugin.jar"/>

      </resources>
 <application-desc main-class="Harper_Upload_Final"/>
    </jnlp>

Even if provided dependent jars under resources tab, I am getting error like below:

java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
    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.doLaunchApp(Unknown Source)
    at com.sun.javaws.Launcher.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.methods.HttpUriRequest
    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)
    ... 7 more

Kindly check Structure of projects below

JWSINSTEADOFAPPLET
    |
     SRC
       |
         PACKAGE
           |
             .java file
    |
     JBoss 7.1 Runtime
    |
      Maven Dependencies
    |
      JRE System Library
    |
      Web Content
         |
           META_INF
         |
           WEB_INF
             |
              lib
                 |.jars
         HelloWorld.jnlp
         index.html
         MyHarper.jar   

    |
      pom.xml   

What need change Let me know ,Thanks in Advance

Lokesh
  • 1
  • 3
  • *"Kindly check my JNLP file."* Check the JNLP using JaNeLA, available at my [share drive](https://drive.google.com/drive/#folders/0B5B9wDXIGw9lUnJaUjA2cmlVRE0). – Andrew Thompson Mar 30 '17 at 07:33
  • Show the structure of the server, as it relates to all the Jars. I **suspect** this `` should actually be `` (N.B. only different by a single, very important, character). If I'm right, that should apply to the elements for all the jars in the `lib` directory. – Andrew Thompson Mar 30 '17 at 07:36
  • Kindly check the Edit question which contains structure of project and let me know if any changes in structure – Lokesh Mar 30 '17 at 09:58
  • Ahh. I think I see the problem. From [this answer](http://stackoverflow.com/a/19786283/418556) *"**The WEB-INF node is not part of the public document tree of the application.** No file contained in the WEB-INF directory may be served directly to a client.."*. Try doing a direct fetch (by typing the path in your browser) for one of the Jars and report what happens. – Andrew Thompson Mar 30 '17 at 13:09
  • Hi Andrew, Thanks to provide valuable answer.Now it's working fine,But i need to know how to stop multiple JNLP downloads When click on Link from Browser which contains LInk of JNLP file.Thanks in Advance. – Lokesh Mar 31 '17 at 06:34
  • *"But i need to know how to stop multiple JNLP downloads When click on Link from Browser"* You'll need to ask a separate question for that. (SO is a Q&A site, not a help desk.) But be sure to clarify what you mean, which is not clear to me. Do you mean there should only be a single instance of the app. on-screen? – Andrew Thompson Mar 31 '17 at 11:58

1 Answers1

1

From this answer ..

The WEB-INF node is not part of the public document tree of the application. No file contained in the WEB-INF directory may be served directly to a client..".

Try doing a direct fetch (by typing the path in your browser) to confirm the server will deny the request.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433