• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP File Not Found  RSS feed

 
Tom Pepe'
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use the XMLTransform class to parse the xml generated by the XMLEncoder into html using an xsl file in the same directory as the jar file and as the JSP file, but I keep getting the exception that the file cannot be found. How do I create a file object in JSP which refrences a file on my website?
Thanks!
Tom Pepe
 
Eelco den Heijer
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try the entire path to the XSL-T file? Did you try putting the directory into the servlet engine's classpath? I can recommend hiding the XSL-T from your users; i.e. putting it in an inaccessible directory (not in the same dir as your JSP's).
Hope this helps.
 
Tom Pepe'
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with your security idea but right now I am just trying to get it working. What do you mean by "servelet engine's classpath?"
Thanks,
Tom
 
Tom Pepe'
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is I keep getting this error:
java.io.FileNotFoundException: http:/www.mycgiserver.com~trp956s/Firefly/XMLbeanReportGenerator.xsl
(No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:103)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at java.io.FileReader.<init>(FileReader.java:41)
at __27etrp956s._Firefly._ClientSignUp__jsp._jspService(/~trp956s/Firefly/ClientSignUp.jsp:36)
at com.caucho.jsp.JavaPage.service(JavaPage.java:74)
at com.caucho.jsp.Page.subservice(Page.java:485)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:181)
at com.caucho.server.http.Invocation.service(Invocation.java:291)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:341)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:268)
at com.caucho.server.TcpConnection.run(TcpConnection.java:136)
at java.lang.Thread.run(Thread.java:543)
Thanks
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tom Pepe':
I keep getting the following error:
java.io.FileNotFoundException: http:/www.mycgiserver.com~trp956s/Firefly/XMLbeanReportGenerator.xsl
(No such file or directory)
no matter how many /'s I type the server searches http:/www.mycgiserver.com. Is there another way to access my file ps the jsp file is at www.mycgiserver.com~trp956s/Firefly/ClientSignUp.jsp [/URL]

*Originally posted in the I/O forum by Tom, may help to clarify the error
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the following
java.io.FileNotFoundException: http:/www.mycgiserver.com~trp956s/Firefly/XMLbeanReportGenerator.xsl

it looks to me like you are supplying a URL where a file-system reference is required. The java.io package doesn't know squat about URLs.
hth,
bear
 
Tom Pepe'
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok so how do I refer to a file for file io using JSP? certainly someone has wanted to access a file using JSP before. All I want is the simplest answer to this question - How do I create a File object refering to a document online in JSP?
Thanks again,
Tom
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The File object will not be able to access a file by URL, you need the filesystem path. If the file resides somewhere within the web application, you can locate it with the help of the ServletContext.getRealPath() method. if not, you need to supply the absolute file path somehow (properties etc).
hth,
bear
[ September 19, 2003: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!