Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

File Upload from Servlet Using JCIFS

 
Ranch Hand
Posts: 2131
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am tying to get the following servlet to work with JCIFS but I get an error:

SystemOut O java.io.FileNotFoundException: smb:\webergv;xxx:xxx@gvsvr03\drawings\wgen\pre_pdf\sourcefiles\862000\862144B1.rtf (The filename, directory name, or volume label syntax is incorrect)


 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you independently verify that there is a file at?

gvsvr03\drawings\wgen\pre_pdf\sourcefiles\862000\862144B1.rtf

Can you independently verify that you have permission to?

smb:\webergv;xxx:xxx@gvsvr03
 
Steve Dyke
Ranch Hand
Posts: 2131
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martijn Verburg wrote:Can you independently verify that there is a file at?

gvsvr03\drawings\wgen\pre_pdf\sourcefiles\862000\862144B1.rtf

Can you independently verify that you have permission to?

smb:\webergv;xxx:xxx@gvsvr03



Yes to the above. However, I have changed my code and got it to work from my workbench using local server host but when I move it to the production server(iSeries - AS400 server) it says in file does not exist. How can I get the servlet to see a file on the client so it can be uploaded?


 
Martijn Verburg
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
smb:\webergv;xxx:xxx@gvsvr03 is the bit I'd be investigating (I've never seen that protocol used directly from java, it's Samba right?). Can you write a small stand alone class/method to test that you can connect via this method? Try connecting to a different server and/or using different credentials and/or looking for a different file (perhaps one at the root level of the server file system).
 
Steve Dyke
Ranch Hand
Posts: 2131
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martijn Verburg wrote:smb:\webergv;xxx:xxx@gvsvr03 is the bit I'd be investigating (I've never seen that protocol used directly from java, it's Samba right?). Can you write a small stand alone class/method to test that you can connect via this method? Try connecting to a different server and/or using different credentials and/or looking for a different file (perhaps one at the root level of the server file system).



I don't understand because the JCIFS library was suggested by another JavaRanch person. I am currently using it to read directory contents. And it works just fine locally.

My code is breaking on the FileInputStream line.

SystemOut O No such path or directory. C:\SDETest.rtf
 
Martijn Verburg
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I thought you said above that you had it working locally?

However, I have changed my code and got it to work from my workbench using local server host but when I move it to the production server(iSeries - AS400 server) it says in file does not exist.



 
Steve Dyke
Ranch Hand
Posts: 2131
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martijn Verburg wrote:I thought you said above that you had it working locally?



Steve Dyke wrote:

That is correct:

I don't understand because the JCIFS library was suggested by another JavaRanch person. I am currently using it to read directory contents. And it works just fine locally.

My code is breaking on the FileInputStream line.

SystemOut O No such path or directory. C:\SDETest.rtf



The FileInputStream does not fail when I run on local Application Server just on production server. It is behaving like when ran from production application server that it is trying to find the file on that local server instead on the client machine.
 
Martijn Verburg
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, OK I think I was looking at the wrong problem. So the real problem is that



Is returning you a list of Items who's names are like "C:\SDETest.rtf", so when you execute:



It can't find it on the server because "C:\SDETest.rtf" doesn't exist.

So question is, where _is_ SDETest.rtf on the server? And why isn't the item.getName() returning the real location?
 
Steve Dyke
Ranch Hand
Posts: 2131
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martijn Verburg wrote:

So question is, where _is_ SDETest.rtf on the server? And why isn't the item.getName() returning the real location?



What other property or method of FileItem can I use to get the real location?
 
Steve Dyke
Ranch Hand
Posts: 2131
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martijn Verburg wrote:
It can't find it on the server because "C:\SDETest.rtf" doesn't exist.

So question is, where _is_ SDETest.rtf on the server? And why isn't the item.getName() returning the real location?



I have changed the FileInputStream to:



This seems to work but is this the correct way?
 
Martijn Verburg
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would argue that is a better way yes, as you're wanting to deal with data streams as opposed to a physical file.
 
Steve Dyke
Ranch Hand
Posts: 2131
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martijn Verburg wrote:I would argue that is a better way yes, as you're wanting to deal with data streams as opposed to a physical file.



Thanks for all your help. I have just started developing in Java and have a long way to go.
 
Martijn Verburg
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No worries! Glad you were able to solve the problem (always the best way to learn!)
 
reply
    Bookmark Topic Watch Topic
  • New Topic