Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FileNotFoundException from Servlet

 
Ajai
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am trying to access a PDF file on shared windows folder from a servlet running on UNIX server.
The path seems to be correct x:\shared\x.pdf
but when servlet tries to access this file it throws FileNOtFoundException even though file is there..
Any suggestions.
Thanks
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the servlet is running on a Unix server, what does x:/ mean? ie how is the servlet going to find the PDF given this information?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The jCIFS library (jcifs.samba.org) can access Windows shares, and has an interface exactly like java.io.File, so it's rather easy to use.
 
Ajai
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the replies.

David ,

Just trying to share my problem again.

I want to read a file on window share from servlet running on app server.
Is it possible ?

Thanks
 
Roman Tomachinsky
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try using Microsoft Windows UNC path name, like \\computer\shared\x.pdf?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you actually read and consider the replies you got? David is spot on: the server can't possibly know what "x:\shared\x.pdf" is, because that path has meaning only locally on the Windows machine. That's why you need to use jCIFS.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic