• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

The system cannot find the path specified

 
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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 ]
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic