ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ashutosh Kumar" <ashutosh.ku...@ionidea.com>
Subject RE: calling ant from java program
Date Fri, 27 Aug 2004 07:20:14 GMT
What may be the reason of  project.executetarget throwing nullpointer
exception?
regds

 public void execute(Project project){
         Class wlConfigtaskDef=null;
          try {
            wlConfigtaskDef=
Class.forName("weblogic.ant.taskdefs.management.WLConfig");
          }
          catch (ClassNotFoundException ex) {
          }
 
         project.addTaskDefinition("wlconfig",wlConfigtaskDef);
           Target configWeblogic=new Target();
           configWeblogic.setName("test_config");
           WLServer wlserver=new WLServer();
           wlserver.setUserName("weblogic");
           wlserver.setPassword("weblogic") ;
           wlserver.setDomainName("testdomain") ;
           wlserver.setServerName("myserver") ;
           wlserver.setDir(new
File("C:/bea/user_projects/domains/testdomain"));
           wlserver.setHost("127.0.0.1") ;
           wlserver.setPort(7001) ;
           wlserver.setGenerateConfig(false) ;
           configWeblogic.addTask(wlserver);
           project.addTarget(configWeblogic);
           project.executeTarget("test_config");

  }

-----Original Message-----
From: Olivier Croisier [mailto:Olivier.Croisier@thales-is.com] 
Sent: Thursday, August 26, 2004 1:44 PM
To: Ant Users List
Subject: Re: calling ant from java program

Hi

Hummm I dont see why it doesn't work for you...
Maybe it is a matter of Ant versionning ? I use the latest stable build
(1.6.2 I think).

The error stack trace seems to point out a Sax error, as if the parser
couldn't properly manage some element in the build file. Or it may come
from the ProjectHelper class, that performs some standart initialization
of the Project object.

Again, I would recommend trying with the latest versions (parser, ant,
etc.).
Or, if you can't change, try to see how to initialize the Project
manually, ie without using the ProjectHelper ?

Please keep me informed of your problems/successes !

PS : anyone experiencing similar problems with my class ?

-- 
CROISIER Olivier
Software Engineer
Thales IS - ANS
olivier.croisier@thales-is.com

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



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


Mime
View raw message