• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

File Upload from Servlet Using JCIFS

 
Ranch Hand
Posts: 2274
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: 3285
13
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: 2274
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: 3285
13
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: 2274
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: 3285
13
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: 2274
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: 3285
13
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: 2274
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: 2274
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: 3285
13
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: 2274
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: 3285
13
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!)
 
What's gotten into you? Could it be this tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic