× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I'm not sure too sure about FTP and don't fully get the context in which you
are using it, but..


There is an AS400FTP class in the java toolbox, could you use that instead?

com.ibm.as400.access.AS400FTP

neill
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Tamas Perlaky
Sent: 14 October 2008 21:23
To: Java Programming on and around the iSeries / AS400
Subject: Re: Using Apache VFS to FTP to the AS/400 IFS

Hi Sarah,

Since you're not using FTP directly (i.e. with VFS as an intermediate
layer) your only option may be to change the system default to *PATH
naming (NAMEFMT 1) via the CHGFTPA command. Of course this may break
other things which expect *SYS naming (NAMEFMT 0) so be sure to check
with any appropriate parties first.

If you were using a different FTP client you might be able to use an
FTP site command to issue a literal SITE NAMEFMT 1 to the FTP server
to effect this switch. This may somehow be possible with VFS but I'm
not familiar with it at all so I can't make a recommendation there.
Another trick would be to force the first command of your FTP session
to be a CD such that the directory specified starts with a slash (e.g.
"CD /home/aplsup"), in which case the leading slash would trigger an
implicit switch to *PATH naming for that session...

If you're looking for an FTP client library I can recommend jScape's
(commercial license) which I quite like. I've also used /n software's
(also commercial), which I quite dislike.

t.

On 14-Oct-08, at 1:36 PM, Sarah Poger Gladstone wrote:

I have been using the Apache VFS API's to upload to Unix FTP servers
successfully. But I am unable to upload to the IFS on my AS/400. I
can upload to QGPL, but not the IFS.

Below is an excerpt from my Java code:

FileSystemManager mgr;
try {
mgr = VFS.getManager();

FileSystemOptions fileSystemOptions;
FileSystemOptions opts = new FileSystemOptions();
fileSystemOptions = opts;
FtpFileSystemConfigBuilder
.getInstance().setUserDirIsRoot(fileSystemOptions,
true);

String strLocalFile =
"C:\\sgladstone\\edfiles\\mydata.txt";
FileObject foLocalFile =
mgr.resolveFile(strLocalFile);
String rUrlStr =
"ftp://myusername:mypassword@myas400/home/aplsup/sarahtest.txt"; ;
FileObject foRemoteFile = mgr.resolveFile( rUrlStr,
opts);


FileSelector fS = Selectors.SELECT_SELF ;
foRemoteFile.copyFrom(foLocalFile, fS);


When I run this code, it throws the exception:

Caused by: org.apache.commons.vfs.FileSystemException: Could not
create FTP directory "ftp://myusername:mypassword@myas400/home";


I think this issue is caused by the AS/400 trying to use System
naming, instead of using NAMEFMT=1.

Any ideas of how to get the VFS APIs to get the AS/400 to switch to
NAMEFMT =1 ?

Thanks,
Sarah
--
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.