[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

4.6

File does not transfer from UNIX to Windows using Apache Commons Net 2.0 FTPClient

Asked by infotechCDI in Java Programming Language, HP-UX Unix, File Transfer Protocol (FTP)

Tags: Java, Commons Net 2.0

I am working on creating a program which is meant to run on our HP-UX system.  The purpose of having it run on UNIX is to help with automating our process.  There is an app that runs on UNIX which generates a file, and I created a program which takes this file, converts to XML, and ftp's it to our Windows FTP Server (where it is picked up by a vendor).

The problem I am running into is that even though my logs show 'file transfer successful', the file is never uploaded to the FTP server.  Code below is from a test program I created just to work on the file transfer specifically. I've tried both the storeFile & remoteStore method.  When I use storeFile, it actually uploads an empty file named 123.txt.  When I use remoteStore nothing happens, but it does claim the file was transferred successfully.

I'm sure it's something simple like a configuration but I've tried several different things so far - setting transfer type to Binary, using FTPClientConfig to specify a UNIX system, etc. - with no luck. Any help is appreciated.

Thanks in advance.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
import java.io.IOException;
import org.apache.commons.net.ftp.*;
import java.io.File;
 
public class TestFtp {
	private static FTPClient ftp;	
 
	public static void main(String[] args) {
		try	{
		  ftp = new FTPClient();
		  ftp.connect("ftp.mydomain.com");
		    
		  int reply = ftp.getReplyCode();
		  if(!FTPReply.isPositiveCompletion(reply)) {
		    ftp.disconnect();
		    System.out.println("FTP server refused connection.");
		    System.exit(1);
		  } else {
		    if (!ftp.login("denisem", "password")){
	            ftp.logout();
	            throw new FTPConnectionClosedException();
	          }
		  System.out.println("Successfully logged into CDI ftp.");
		  ftp.enterRemotePassiveMode();
		  
		  File file = new File("/home/denisem/123.txt");
		  if (file.exists()){
                    //FileInputStream fis = new FileInputStream("/home/denisem/123.txt");
		    //ftp.storeFile("123.txt", fis);
		    //fis.close();
		    ftp.remoteStore("/home/denisem/123.txt");
		    System.out.println("File successfully transferred");
		 } else
		    System.out.println("Cannot find the file on the local system");
               }
	       ftp.logout();
	       }catch(FTPConnectionClosedException ex){
		  System.out.println("The connection to the CDI has been closed unexpectedly: " + ex.getMessage());
                  System.exit(1);
		}catch(IOException ex){
		   System.out.println("A problem occured during file transfer with CDI ftp: " + ex.getMessage());
                   System.exit(1);
 	       } finally {
                   if(ftp.isConnected()) {
	           try {
	             ftp.disconnect();
	           } catch(IOException ioe) {} 
	      }
 	    }		
   }
}
[+][-]10/30/09 08:24 AM, ID: 25703886Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/30/09 08:52 AM, ID: 25704165Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]10/30/09 08:58 AM, ID: 25704241Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/30/09 09:26 AM, ID: 25704531Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/30/09 09:27 AM, ID: 25704548Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/30/09 09:29 AM, ID: 25704574Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/30/09 09:31 AM, ID: 25704592Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/30/09 09:34 AM, ID: 25704626Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/30/09 09:40 AM, ID: 25704684Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/30/09 09:45 AM, ID: 25704725Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/30/09 10:13 AM, ID: 25704988Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/30/09 10:20 AM, ID: 25705058Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/30/09 10:41 AM, ID: 25705234Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/30/09 10:49 AM, ID: 25705291Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/30/09 03:06 PM, ID: 25707110Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/30/09 03:08 PM, ID: 25707117Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]11/02/09 06:46 AM, ID: 25719759Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/02/09 07:05 AM, ID: 25719976Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/02/09 07:32 AM, ID: 25720257Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/02/09 08:41 AM, ID: 25720936Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]11/02/09 11:43 AM, ID: 25722914Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/02/09 11:54 AM, ID: 25723042Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/02/09 11:58 AM, ID: 25723082Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Java Programming Language, HP-UX Unix, File Transfer Protocol (FTP)
Tags: Java, Commons Net 2.0
Sign Up Now!
Solution Provided By: infotechCDI
Participating Experts: 3
Solution Grade: A
 
[+][-]11/02/09 01:13 PM, ID: 25723791Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/02/09 01:16 PM, ID: 25723817Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/02/09 01:21 PM, ID: 25723871Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/02/09 01:25 PM, ID: 25723914Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625