Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FileNotFoundException - Access Denied

 
Matthew L Williams
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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: java.io.FileNotFoundException: \\dev\statistics\software\validation\avet-db.jar (Access is denied)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<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">
<information>
<title>Title</title>
<vendor>Company A</vendor>
<description>Description - DEVELOP</description>
<offline/>
</information>
<security>
<all-permissions/>
</security>
<resources os="Windows">
<j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se" 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 ...
</resources>
<application-desc main-class="com.comp.main.MainClass"></application-desc>
</jnlp>


does anyone have any ideas ??

TIA

Matthew
 
Mat Williams
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Mat
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic