aspose file tools*
The moose likes JNLP and Web Start and the fly likes Launch Exception encountered in Java Web Start Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "Launch Exception encountered in Java Web Start" Watch "Launch Exception encountered in Java Web Start" New topic
Author

Launch Exception encountered in Java Web Start

kumari Jain
Ranch Hand

Joined: Jul 28, 2004
Posts: 44
Launching Error encountered

Hi everyone,
I am trying to deploy a Swing Application using Java Web Start on Tomcat Server.The jnlp file

invokes Web Start .Then the Web Start manager displays the following error.

An error occurred while launching/running the application.

Category: Launch File Error


MissingFieldException[ The following required field is missing from the launch file:

<jnlp>(<application-desc>|<applet-desc>|<installer-desc>|<component-desc> ]at

com.sun.javaws.jnl.xml.XMLFormat.parse(Unknown Source)at

com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)at

com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)at

com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)at

com.sun.javaws.Main.main(Unknown Source)

This is the JNLP file (Calendar.jnlp).Can someone tell me if there is any error in this.Or is it something else
which is generating the error???

<?xml version="1.0" encoding="UTF-8"?>

<jnlp codebase="http://localhost:8080/Test">

<href="Calendar.jnlp">

<information>

<title>Branch Automation System</title>

<vendor>Java Developer Connection</vendor>

<homepage href="Test.html"/>

<description>Demonstration of JNLP</description>

</information>

<offline-allowed/>

<security>

<all-permissions/>

</security>

<resources>

<j2se version="1.3"/>

<jar href="Calendar.jar"/>

</resources>

<application-desc main-class="CalendarTest">

</application-desc>

</jnlp>

Thanks in advance
kumari
jin xiuqi
Greenhorn

Joined: Jul 25, 2004
Posts: 2
your main-class field must be add the full path of the jar. you can add the path of jar and try again.
kumari Jain
Ranch Hand

Joined: Jul 28, 2004
Posts: 44
Originally posted by kumari Jain:
[QB]Launching Error encountered

I took this jnlp file from the net and modified it to refer my application.
Now I don't get the Launch Error exception.But I can't make out if is any

different from the previous file I used.

This JNLP works

<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for SwingSet2 Demo Application -->
<jnlp
spec="1.0+"
codebase="http://localhost:8080/Test"
href="TestJNLP.jnlp">
<information>
<title>SwingSet2 Demo Application</title>
<vendor>Sun Microsystems, Inc.</vendor>
<homepage href="Test.html"/>
<description>SwingSet2 Demo Application</description>
<description kind="short">A demo of the capabilities of the Swing

Graphical User Interface.</description>
<icon href="images/logo.gif"/>
<offline-allowed/>
</information>
<resources>
<j2se version="1.3"/>
<jar href="Calendar.jar"/>
</resources>
<application-desc main-class="CalendarTest"/>
</jnlp>

Anyway now I have a different problem.
The web start manager starts fine.It then displays the message and does

nothing.

Starting Application....

Should I set the classpath in Environment variables(Windows 2000)??
If yes,what should it be(ie.should it refer to the cache where appln is

dowloaded??)
Why is it unable to display the application??
parthiban subramaniam
Ranch Hand

Joined: May 15, 2002
Posts: 116
in the jar's manifest add this entry "Main-Class: com.domain.YourMainClass"

and do the same to your jnlp file
not just the class name but the fully qualified class name

hope that helps

cheers
parthi


Even crazy and silly looking problems are sometimes real.
kumari Jain
Ranch Hand

Joined: Jul 28, 2004
Posts: 44
After i specified the mainclass in the manifest file and the JNPL,it started
working.The application is invoked .
Thanks so much for the prompt help.

Regards,
kumari
kumari Jain
Ranch Hand

Joined: Jul 28, 2004
Posts: 44
The saga continues
Now the problem is if an update is present at the server,then Java Web Start downloads the new update in the cache but the JWS Manager shows both the old version and the new updated version .What can I do to ensure that only one version(latest one) of the same application is shown to the user in the JWS Manager to launch it ???

regards,
kumari
parthiban subramaniam
Ranch Hand

Joined: May 15, 2002
Posts: 116
you got the there,
what version of jre are you using?
try using the jws packaged with jre 1.4.2_05

hmm strange are you sure there are 2 apps being displayed ?
one being the old version and the one being the updated one
kumari Jain
Ranch Hand

Joined: Jul 28, 2004
Posts: 44
Hi,
I am using JRE 1.3
I have tried running the application using JRE 1.4 and now the previous
version is not being displayed.Only the current version of the dowloaded
application is shown.So i guess using JRE 1.4 is the solution.Thank parthiban for the suggestion.

Now another issue has surfaced.
Images(.gif) are not displayed in the application.
Although properties file is picked up, the images are not picked up by the application though both exist in the same folder.If i run the JAR file,the appln displays the icons.But if i run the appln via Web Start,the icons are not displayed.
Can you help???
parthiban subramaniam
Ranch Hand

Joined: May 15, 2002
Posts: 116
how are you trying to load them?
getResourceAsStream should do the trick,

you need to have them in the classpath though

cheers,
parthi
kumari Jain
Ranch Hand

Joined: Jul 28, 2004
Posts: 44
getResource() works for images.Thanks parthiban.But the getResourceAsStream () doesn't workwhen i try to load a stylesheet.

My application generates an HTML file.This file uses a stylesheet which is there in the classpath.When i start the appln thro web start ,the HTML file is stored in Program Files folder,and hence the css is not accessible to it.
Hence the styles are not applied.

I am linking the CSS to the HTML file as follows.

FileWriter o=new FileWriter("Invoice.html",false);
pw= new PrintWriter(o,true);
pw.print("<html>");
pw.print("<head>");

ClassLoader classload = this.getClass().getClassLoader();
InputStream input = classload.getResourceAsStream("css/style.css");
pw.print("<link rel=stylesheet type=text/css href="+input+">");

pw.print("<STYLE TYPE=text/css>");
pw.print("P.breakhere {page -break-before: always}");
pw.print("</STYLE>");
pw.print("<title>Invoice</title>");
pw.print("</head>");
pw.print("<body>");
.................

Can i also specify where to save the file through classloader,so that css folder is accessible to it??
parthiban subramaniam
Ranch Hand

Joined: May 15, 2002
Posts: 116
can not understand what you require here
kumari Jain
Ranch Hand

Joined: Jul 28, 2004
Posts: 44
Actually,in my swing application,i write an html file(eg Invoice.html).The content of this

html file uses the styles defined in css/style.css file.
When I am jaring the java files ,i also include this folder(css) and then deploy it on the server(Weblogic 8.1).

Now the problem is that when I run the application (through Java Web Start )to generate the HTML file it stores this file at this location

C:\Program Files\Java Web Start\Invoice.html

Now since the css/style.css is in the Jar file which is at this location

C:\Program Files\Java Web Start\.javaws\cache\http\D130.10.7.76\P7001\DMmainWebApp\DMBasis\RMBasis.jar


The contents of Invoice.html do not have the styles defined in style.css

Is there anyway i can specify the path for Invoice.html so that it can be stored at a place where
RMBasis.jar is present.???

Now does the problem make sense?
parthiban subramaniam
Ranch Hand

Joined: May 15, 2002
Posts: 116
Hmm yeah,
Seems like it can be less complicated for you to manage if you do those things at the server side and send them to the client for display,
that way you have more control over resources,

i'm not sure about how your way of doing things can be achieved as there is little control over what we can access and where to find the resources at the client side

Parthi
kumari Jain
Ranch Hand

Joined: Jul 28, 2004
Posts: 44
I have found a workaround.
When the application starts ,i create the CSS file at the client side.
So when the html file is generated by the appln,it is stored at the location where the CSS file is present and hence the styles are applied to the HTML file.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Launch Exception encountered in Java Web Start