commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbre...@wi.rr.com (Jeffrey D. Brekke)
Subject Re: [NET] FTP upload works from test environment but not production {Scanned}
Date Thu, 20 May 2004 04:43:04 GMT

I belive you will need to issue the completePendingCommand() message
on the client before closing down the connection.  The javadocs for
storeFileStream should have this information.

>>>>> On Wed, 19 May 2004 21:11:39 -0400, bort <spambort@rogers.com>
said:

> I thought that maybe the filecontents (String) variable was empty as
> well, so I place a System.out.println inline with the code below to
> spit it out.... and it was fine.

> I'm not sure how it could be a permissions or path issue, since the
> file does get created on the FTP server.  It just doesn't get filled
> with anything.

> Do you have any code that uploads a stream of text to an FTP site
> that I could compare mine to?

> bort

> "Bill Simpson" <wsimpson@syntricity.com> wrote in message
> news:NFBBKGMGKMFLLCJGCCHAIEPADFAA.wsimpson@syntricity.com...
>> My guess is that your filecontents variable has nothing in it.
>> When
> you're
>> on the deployed server you either don't have permissions or the
>> path is incorrect.  I don't see in this code where you set that
>> variable up, so I
> am
>> only speculating.  Good luck.
>> 
>> -----Original Message----- From: news [mailto:news@sea.gmane.org]On
>> Behalf Of bort Sent: Wednesday, May 19, 2004 5:34 PM To:
>> commons-user@jakarta.apache.org Subject: [NET] FTP upload works
>> from test environment but not production {Scanned}
>> 
>> 
>> Hi all
>> 
>> I've successfully implemented the Commons-Net package on my local
>> Tomcat server.  I am able to make a connection to a remote FTP
>> server, and write
> an
>> OutputStream to it.  The code is as follows:
>> 
>> =======
>> 
>> FTPClient ftp = new FTPClient(); OutputStreamWriter osw = null;
>> 
>> try {
>> 
>> ftp.connect(server);
>> 
>> if (username != null && username.length() > 0) {
>> ftp.login(username, password);
>> }
>> 
>> ftp.setFileType(FTP.BINARY_FILE_TYPE); ftp.enterLocalPassiveMode();
>> 
>> osw = new OutputStreamWriter(ftp.storeFileStream(filename));
>> osw.write(filecontents);
>> 
>> osw.close();
>> 
>> ftp.disconnect();
>> 
>> } catch (Exception e) { e.printStackTrace();
>> }
>> 
>> =======
>> 
>> Problem is that when I transfer this code to a standalone Tomcat
>> server elsewhere, I get some peculiar behaviour.  The file gets
>> created on the
> FTP
>> Server, but it has a size of 0 bytes.  It seems as if the
> OutputStreamWriter
>> is not sending the information out, to be written to the file.
>> 
>> Anyone have any ideas as to why this is happening?  If you need
>> more information, please let me know.
>> 
>> bort
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail:
>> commons-user-help@jakarta.apache.org




> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org

-- 
=====================================================================
Jeffrey D. Brekke                                   jbrekke@wi.rr.com
Wisconsin,  USA                                     brekke@apache.org
                                                    ekkerbj@yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message