aspose file tools
The moose likes JNLP and Web Start and the fly likes FileNotFoundException - Access Denied 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 "FileNotFoundException - Access Denied" Watch "FileNotFoundException - Access Denied" New topic

FileNotFoundException - Access Denied

Matthew L Williams

Joined: Apr 18, 2007
Posts: 2
Hi all,

I am getting the following exception when trying to run a java web start application under jre 1.6.0_01 It works fine as is under 1.5.0_11

Caused by: \\dev\statistics\software\validation\avet-db.jar (Access is denied)
at Method)
at<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)

The JNLP file looks like the following

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

<jnlp spec="1.0+" codebase="http://dev/statistics/avet/software/validation" href="avet.jnlp">
<vendor>Company A</vendor>
<description>Description - DEVELOP</description>
<resources os="Windows">
<j2se version="1.5+" href="" max-heap-size="512M"/>
<nativelib href="native/avet.dll.jar"/>
<nativelib href="native/avetuser32.dll.jar"/>
<nativelib href="native/btree32.dll.jar"/>
<jar href="avet/avet.jar"/>
<jar href="avet/avet-resources.jar"/>
<jar href="avet/avet-reports.jar"/>
<jar href="avet/avet-config.jar"/>
<jar href="avet/avet-db.jar"/>
.... there are other jars here that have been removed for simplicity ...
<application-desc main-class="com.comp.main.MainClass"></application-desc>

does anyone have any ideas ??


Mat Williams
Ranch Hand

Joined: Jul 20, 2005
Posts: 215
Hi ya,

Well I found the answer
It turns out that the code was getting a handle on one of the jar files that the application uses (avet-db.jar) and was trying to unzip the jar onto the remote machine, this was a simple way of deploying the resources in the jar file onto the remote machine.

This was possible in Java Web Start 1.5.x as the application was able to look inside the Java Web Start cache and get a file handle to a jar file in the cache. In Java Web Start 1.6.x this is no longer possible the file handle is invalid as you are no longer allowed to look inside the cache and get a file handle to a jar there.

So the answer - well the code will need to change so that the application gets the ClassLoader and uses that to get all the resources in the jar file, and then persist them to disk (ClassLoader.getResource() then save it to disk). I am also looking at the possibility of having only 1 file in the jar file that is zipped - I then persist the file to disk and unzip it there - this is a bit messy but it means that if more resources are added to the jar file later properties do not need to be changed so that the resources are obtained from the jar (using ClassLoader.getResource()) and then saved to disk.

I agree. Here's the link:
subject: FileNotFoundException - Access Denied