aspose file tools*
The moose likes Servlets and the fly likes The system cannot find the path specified Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "The system cannot find the path specified" Watch "The system cannot find the path specified" New topic
Author

The system cannot find the path specified

carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

Hi i have written a jsp which browse for a file and read its contents .. when i browse the file the IE is passing complete file path to the servlet
C:\example\book1.xls where as when i try to run the same program on Firefox it says file cannot be found.. seeing this is thought i will restrict my application to be used on IE, but now when i run my app(server running on my machine) from other machine it tries to search the file on my machine and give errors

[error]

C:\Documents and Settings\rsrinivasan\Desktop\plots.xls (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at excelread.FAFilePopulate.doGet(FAFilePopulate.java:38)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)



Input.jsp

where onchange send the file name to the servlet
ReadFile.java




please suggest me something how do i get the file path where instance of the application is running on some other system other then mine

[ November 06, 2008: Message edited by: Paul Sturrock ]
[ November 09, 2008: Message edited by: ruquia tabassum ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


where onchange send the file name to the servlet

What uploads the file to the server? Does the file C:\Documents and Settings\rsrinivasan\Desktop\plots.xls exist on the server?
[ November 06, 2008: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

as tomcat is running on my system c:\Documents and Setting\rsrinivasan\plots.xls doesnot exists on my system, plots.xls file exists on the system name rsrinivasan.... as instance of my application is running on rsrinivasan system from there when a file is uploaded it gives me the error "system cannot find the path specified"
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14426
    
  23

The way you're trying to do it, doesn't work.

Tomcat does not automatically get the file and does not automatically save it on the server if you add a file upload input element on your HTML form. You need something to handle the file upload. Use a library, such as Apache Commons FileUpload for example, to get the file from the client computer and save it on the server.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

Instead of saving the file from client computer on the server machine cant there be any other possible solution? because i cannot store the file on the server machine it increases the overhead on server, the application is accessed by suppose 100 employees and every one uploads a file every 10 minutes and each file is more than 500KB per day around 50000 files get stored on the serve machine ... which makes the server less efficient,slow.

if i run a batch such that the temporary files stored are to be deleted every morning still there will be some point of time in a busy day where the server gets loaded with large data and becomes slow.
Also as the server maintains all the live database i cannot store and delete files from it very frequently...

Please suggest me something how do i solve this issue...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The system cannot find the path specified