Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / July 2007

Tip: Looking for answers? Try searching our database.

[JNLP]trying to install a jnlp app on a web server

Thread view: 
Daniel Moyne - 22 Jul 2007 12:20 GMT
I have a Java app installed locally that works fine on my machine and I want
to make it work on my web server ; the architectecture of this app is as
follows :
- "run.sh" (script that launches the app with this command line :
$JAVA_HOME -Dapp.log.level=FINE -Xmx512m -Xms32m -jar run.jar
- "run.jar" the main file is located at the same level
- "lib" directory containing a collection of jar files
- other directory with mainly data but also other java classes and a few
other jar files used by the application.

I did the following :
- copied golbally the whole structure into my website without the "run.sh"
file but with a "my_file.jnlp" file supposed to be used by WebStart to
launch my app.
- certified all jar files with a keystore of my own.

My "my_file.jnlp" file is like this :

<?xml version="1.0" encoding="utf-8"?>
<!-- Test for Web Start Deployment -->
<jnlp spec="1.0+" codebase="http://virtual1.com/genealogy"
href="my_file.jnlp">
 <information>
   <title>AZUN</title>
   <vendor>Daniel Moyne</vendor>
   <homepage href="http://localhost/genealogy"/>
   <description>Généalogie</description>
   <description kind="short">Généalogie///</description>
   <icon href="icon.gif"/>
   <icon kind="splash" href="splash.gif"/>
   <offline-allowed/>
 </information>
 <security>
   <all-permissions/>
 </security>
 <resources os="Linux">
   <j2se version="1.5+"/>
   <jar href="run.jar"/>
  <jar href="lib/genj.jar"/>
  <jar href="lib/genj_en.jar"/>
  <jar href="lib/genj_fr.jar"/>
  <jar href="lib/console.jar"/>
  <jar href="lib/geo.jar"/>
  <jar href="lib/graphj.jar"/>
  <jar href="lib/jump.jar"/>
  <jar href="lib/jfreechart.jar"/>
  <jar href="lib/jhbasic.jar"/>
  <jar href="lib/libreadline-java-0.8.0.jar"/>
 </resources>
 <application-desc/>
</jnlp>

where :
- "virtual1.com" is an apache2 virtual server (no problem with this as
properly installed)
- "genealogy" is the directory where all the application has been copied
into
- "my_file.jnlp" this file as described above.
- <ressources> some jar files : the main one "run.jar" and all those
included in "lib" directory (what about others ?).

When I click on my jnlp file I get from Webstart an error message saying
that different certificates have been used which for me is not clear as I
have changed certificates with my own keystore on all jar files which here
somehow modifies the original application that runs locally with no
problems !

I prefer to start with these basic questions :
(1) what is the use <ressources> : to download jar files from main server to
client computer and if yes what about the other files containing data ?
(2) in the jnlp file where is the important line telling where to start the
application here "run.jar" as the main jar files if all other jar files
must be include as well  ?
(2) how to provide to WebStart the equivalent of :
"-Dapp.log.level=FINE -Xmx512m -Xms32m"

I will have more from answers.

Thanks.
Andrew Thompson - 23 Jul 2007 03:26 GMT
>I have a Java app ..

GenealogyJ?  (And as an aside, why are people so coy
when giving details on groups?  A 'Java app' - gee,
could you vague that up a little for me?)

>..installed locally that works fine on my machine and I want
>to make it work on my web server ; the architectecture of this app is as
>follows :
>- "run.sh" (script that launches the app with this command line :
>$JAVA_HOME -Dapp.log.level=FINE -Xmx512m -Xms32m -jar run.jar

Yep.  Except for the logging, and that it is a .bat
on Win., it is looking the same as GenJ launch file
here.

Note that I have had some success launching the GenealogyJ
*applet*, though the entire process was rather obscure,
and poorly documented (I only knew it was possible from
stumbling across someone else's deployment).

...
>I did the following :

Forget what you did for the moment, and get to what you
are trying to achieve.  Frame it in terms of "I want to
offer the end user..".  For example, in my instance, I
"want(ed) to offer the end user the opportunity to
view/browse a genealogical file coming directly off
my site".

>My "my_file.jnlp" file is like this :

It is malformed, and contains some odd aspects.

To check the well formedness, try this tool..
<http://www.physci.org/xml/xmltools.html#xmlwfc>
It is not especially good at identifying the exact
part of the file where the error occurs, but the
'short answer' is that is is not liking the 'accute e'
characters (are they 'e accute', or 'e accent'?).  I
am sure such characters can be included in XML files
in some form, though apparently &eaccute; is not the
correct way.

Other comments in-line..

><?xml version="1.0" encoding="utf-8"?>
><!-- Test for Web Start Deployment -->
[quoted text clipped - 4 lines]
>    <vendor>Daniel Moyne</vendor>
>    <homepage href="http://localhost/genealogy"/>

This href clashes with the codebase above.
I expect you mean "." as the homepage.

>    <description>Généalogie</description>

Some of those problem 'e's.

>    <description kind="short">Généalogie///</description>

Why the '///'?

>    <icon href="icon.gif"/>
>    <icon kind="splash" href="splash.gif"/>
[quoted text clipped - 3 lines]
>    <all-permissions/>
>  </security>

The applet can be deployed in a sandbox.
If all you want to do is *display* a genealogy file,
the JNLP does not need all-permissions.

>  <resources os="Linux">

So what resources are Win. and Mac. supposed to get?
AFAIU, GenJ has no system specific parts, so remove
the os="Linux" for an x-plat version.

>    <j2se version="1.5+"/>

GenJ is compatible with Java 1.1, though the mimimum
Java for any JNLP (j2se/java element) is 1.2.

>    <jar href="run.jar"/>
>   <jar href="lib/genj.jar"/>
[quoted text clipped - 7 lines]
>   <jar href="lib/jhbasic.jar"/>
>   <jar href="lib/libreadline-java-0.8.0.jar"/>

Some big resources there.  The applet has only one jar. *

>  </resources>
>  <application-desc/>
></jnlp>

>- <ressources> some jar files : the main one "run.jar" and all those
>included in "lib" directory (what about others ?).

* So I cannot understand why you added al those.

>When I click on my jnlp file I get from Webstart an error message saying
>that different certificates have been used which for me is not clear as I
>have changed certificates with my own keystore on all jar files which here
>somehow modifies the original application that runs locally with no
>problems !

Note that when the sandboxed applet is deployed,
javaws does not even bother to verify the code
signature, if it is possible to deploy this 'app'
sandboxed, it might be possible to sidestep this
entire problem.

>I prefer to start with these basic questions :
>(1) what is the use <ressources> : to download jar files from main server to
>client computer

Yes.  jar's (as well as nativelib's and components) are cached
on the client's computer.  There are some subtleties come in for
'lazy' download jar's, but hese are all 'eager'.

>..and if yes what about the other files containing data ?

Put them in a jar and add them to a 'jar' element.
No problem.  The resources will be available to the
application's classpath (can use getResource() to
find them).

>(2) in the jnlp file where is the important line telling where to start the
>application here "run.jar" as the main jar files if all other jar files
>must be include as well  ?

Depends.  JWS assumes the first jar contains a main
(unless told otherwise - check the JNLP spec. for details)
If the amin jar contains a manifest that specifies the
main class, it is not necessary to refer to it in the
main-class attribute of the application-desc element.

>(2) how to provide to WebStart the equivalent of :
>"-Dapp.log.level=FINE -Xmx512m -Xms32m"

Memory requirements can be specified in the j2se element.
See the 'Giffer' example for usage.
<http://www.physci.org/jws/#giffer>

>I will have more from answers.

You will gain a great deal from downloading the JNLP
spec., and the JNLP Developers guide.  The last one is
browsable on-line, but the spec. is not, and contains
far more, and more valuable, information on the JNLP
API and usage of JNLP files.

HTH

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Roedy Green - 23 Jul 2007 04:01 GMT
>o check the well formedness, try this tool..
><http://www.physci.org/xml/xmltools.html#xmlwfc>
[quoted text clipped - 5 lines]
>in some form, though apparently &eaccute; is not the
>correct way.

The sample you have looks too realistic. It need to have a "SAMPLE"
watermark on it so you don't waste time trying to feed it your
XML/JNLP.

Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Andrew Thompson - 23 Jul 2007 12:44 GMT
>>...check the well formedness, try this tool..
>><http://www.physci.org/xml/xmltools.html#xmlwfc>
...
>The sample you have looks too realistic. It need to have a "SAMPLE"
>watermark on it so you don't waste time trying to feed it your
>XML/JNLP.

Good point.  Try 'feeding one' now.

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Roedy Green - 24 Jul 2007 12:22 GMT
>>The sample you have looks too realistic. It need to have a "SAMPLE"
>>watermark on it so you don't waste time trying to feed it your
>>XML/JNLP.
>Good point.  Try 'feeding one' now.
It is still pretty confusing. You hit X and it just starts another
instance.  Sort of a Sorceror's apprentice.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Roedy Green - 23 Jul 2007 03:58 GMT
><?xml version="1.0" encoding="utf-8"?>
><!-- Test for Web Start Deployment -->
[quoted text clipped - 29 lines]
>  <application-desc/>
></jnlp>

I'm not sure if this will help, but I would try the following changes:

<homepage href="http://localhost/genealogy"/>
to <homepage href="http://virtual1.com/genealogy"
/>

<icon href="icon.gif"/>
to
<icon href="http://virtual1.com/genealogy/image/icon.gif" width="64"
height="64" />

ditto  <icon kind="splash" href="splash.gif"/>

add these lines:
<j2se version="1.6.0_02" java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.6.0_01" java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.6.0"    java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.6+"     java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.5.0_12" java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.5.0_11" java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.5.0_10" java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.5.0_09" java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.5.0_08" java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.5.0_07" java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.5.0_06" java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.5.0_05" java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.5.0_04" java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.5.0_03" java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.5.0_02" java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.5.0"    java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />
 <j2se version="1.5+"     java-vm-args="-ea"
href="http://java.sun.com/products/autodl/j2se"
initial-heap-size="128m" max-heap-size="512m" />

replace   <application-desc/> with
<application-desc main-class="com.virtual1.genealogy.Genealogy" />
(just guessing here at the main-class)

make sure everything is uploaded to
http://virtual1.com/genealogy/ including jars and images (though
normally I put images in their own directory tree)
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Andrew Thompson - 23 Jul 2007 10:51 GMT
>><?xml version="1.0" encoding="utf-8"?>
>><!-- Test for Web Start Deployment -->
[quoted text clipped - 7 lines]
>to <homepage href="http://virtual1.com/genealogy"
>/>

href attributes within JNLP files can be specified
*relative* *to* (anywhere below) the codebase.  
That is one of its purposes.

>add these lines:
><j2se version="1.6.0_02" java-vm-args="-ea"
[quoted text clipped - 3 lines]
>href="http://java.sun.com/products/autodl/j2se"
>initial-heap-size="128m" max-heap-size="512m" />

And this is rubbish.  I am sure I've put the links
before, that should prove it for you.

That represents a notable *error* in your web start
page.  A simple reference to 1.5+ (note the '+') will get
any 1.5, any 1.6, any 1.7...

>replace   <application-desc/> with
> <application-desc main-class="com.virtual1.genealogy.Genealogy" />

Did the jar have a manifest?  As I noted earlier,
the main-class attribute is not *always* required.

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Roedy Green - 24 Jul 2007 10:58 GMT
>>replace   <application-desc/> with
>> <application-desc main-class="com.virtual1.genealogy.Genealogy" />
>
>Did the jar have a manifest?  As I noted earlier,
>the main-class attribute is not *always* required.

You can gave several jars and each one could have a main class.  I
figure it just helps make clear the main class.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Roedy Green - 23 Jul 2007 05:21 GMT
>When I click on my jnlp file I get from Webstart an error message saying
>that different certificates have been used which for me is not clear as I
>have changed certificates with my own keystore on all jar files which here
>somehow modifies the original application that runs locally with no
>problems !
you wan to sign all your jars with the same cert.  That may mean
unpack/repack.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Roedy Green - 28 Jul 2007 09:04 GMT
>My "my_file.jnlp" file is like this :
>
><?xml version="1.0" encoding="utf-8"?>
><!-- Test for Web Start Deployment -->
><jnlp spec="1.0+" codebase="http://virtual1.com/genealogy"
>href="my_file.jnlp">

In the spirit of "did you remember to plug it in?":

Before you launch, you must upload my_file.jnlp to the genealogy
directory of your website. I would get rid of the underscore, on the
general principle of don't do anything needlessly weird.

The jars  must already be uploaded to genealogy/lib

The gifs must already be uploaded to genealogy
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.