ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hugo Costa <hco...@xlm.pt>
Subject Ant Api usage problems
Date Tue, 24 Feb 2004 15:13:10 GMT
Hi,

I'm having problems using some optional tasks of the Ant Api.
The error is always the same, so i must be doing something wrong.
I'm starting in java as well, as you can see...

On example of what i'm doing is this, just trying to login to my own
ftp. I'm on linux. I've tried with Scp and the result is the same.

This builds correctly with ant.
The error is always: java.lang.NullPointerException

I've done another simple example of just making a directory and
unzipping some files there with others ant task (Expand and mkDir),
passing the name of the filezip and the name of the directory.

So i don't understand what's wrong.

I have the jars needed for both scp and ftp, i can use this tasks within
a build.xml with no problems.


------------- Ftp.java -------------------------

import org.apache.tools.ant.Project;
import org.apache.tools.ant.Target;
import org.apache.tools.ant.taskdefs.optional.net.FTP;
import org.apache.tools.ant.BuildException;
import java.io.File;

public class Ftp extends FTP{

	public static void FtpMkDir (String ftpServer, String userId, String
userPassword, String remoteDir) {

		try {
			Project project = new Project();
			
			project.setName("testeftp");
			project.init();

			System.out.println(ftpServer);
			System.out.println(userId);
			System.out.println(userPassword);
			System.out.println(remoteDir);
			
			FTP ftp = new FTP();
			ftp.setServer(ftpServer);
			ftp.setUserid(userId);
			ftp.setPassword(userPassword);

			System.out.println("Ponto 5");
			
			ftp.execute();

		}
		catch (BuildException e) {
			System.out.println("FTP Error: " + e);
		}
		
	}
	
	
}



------------------- Testesftp.java --------------------------


public class Testesftp {

	public static void main (String[] args) {
			
			try{
				Ftp.FtpMkDir (args[0], args[1], args[2], args[3]);				
			}
			catch (Exception e) {
				System.out.println("Testes Error: "+e);
			}		
		}
		
}


------------------ Error when runnig -------------------------

[hcosta@jasao build]$ java -cp
/usr/local/ant/lib/ant.jar:/usr/local/ant/lib/ant-launcher.jar:/usr/local/ant/lib/ant-commons-net.jar:/usr/local/ant/lib/commons-net.jar
Testesftp localhost anonymous pass@site newdir

localhost
anonymous
pass@site
newdir
Ponto 5
Exception in thread "main" java.lang.NullPointerException
   at 0x40268de4: java.lang.Throwable.Throwable()
(/usr/lib/./libgcj.so.3)
   at 0x4025bcaf: java.lang.Exception.Exception()
(/usr/lib/./libgcj.so.3)
   at 0x4025f56f: java.lang.RuntimeException.RuntimeException()
(/usr/lib/./libgcj.so.3)
   at 0x4025ec67: java.lang.NullPointerException.NullPointerException()
(/usr/lib/./libgcj.so.3)
   at 0x4023079a: _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
(/usr/lib/./libgcj.so.3)
   at 0x40230ff4: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw,
_Jv_InterpMethodInvocation) (/usr/lib/./libgcj.so.3)
   at 0x4022e504: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw,
void) (/usr/lib/./libgcj.so.3)
   at 0x4038305c: ?? (??:0)
   at 0x403831e7: ffi_call_SYSV (/usr/lib/./libgcj.so.3)
   at 0x403831a7: ffi_raw_call (/usr/lib/./libgcj.so.3)
   at 0x402306e8: _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
(/usr/lib/./libgcj.so.3)
   at 0x40230ff4: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw,
_Jv_InterpMethodInvocation) (/usr/lib/./libgcj.so.3)
   at 0x4022e504: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw,
void) (/usr/lib/./libgcj.so.3)
   at 0x4038305c: ?? (??:0)
   at 0x403831e7: ffi_call_SYSV (/usr/lib/./libgcj.so.3)
   at 0x403831a7: ffi_raw_call (/usr/lib/./libgcj.so.3)
   at 0x402306e8: _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
(/usr/lib/./libgcj.so.3)
   at 0x40230ff4: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw,
_Jv_InterpMethodInvocation) (/usr/lib/./libgcj.so.3)
   at 0x4022e504: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw,
void) (/usr/lib/./libgcj.so.3)
   at 0x4038305c: ?? (??:0)
   at 0x403831e7: ffi_call_SYSV (/usr/lib/./libgcj.so.3)
   at 0x403831a7: ffi_raw_call (/usr/lib/./libgcj.so.3)
   at 0x402306e8: _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
(/usr/lib/./libgcj.so.3)
   at 0x40230ff4: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw,
_Jv_InterpMethodInvocation) (/usr/lib/./libgcj.so.3)
   at 0x4022e504: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw,
void) (/usr/lib/./libgcj.so.3)
   at 0x4038305c: ?? (??:0)
   at 0x40242dd8: gnu.gcj.runtime.FirstThread.call_main()
(/usr/lib/./libgcj.so.3)
   at 0x402ad02d: gnu.gcj.runtime.FirstThread.run()
(/usr/lib/./libgcj.so.3)
   at 0x4024fc4c: _Jv_ThreadRun(java.lang.Thread)
(/usr/lib/./libgcj.so.3)
   at 0x4021c8ac: _Jv_RunMain(java.lang.Class, byte const, int, byte
const, boolean) (/usr/lib/./libgcj.so.3)
   at 0x08048910: ?? (??:0)
   at 0x42015574: __libc_start_main (/lib/tls/libc.so.6)
   at 0x080486c1: ?? (??:0)





Thank you!


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


Mime
View raw message