Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Null Pointer Exception While calling execute method

 
Srinivas Ivaturi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import org.apache.catalina.ant.AbstractCatalinaTask;
import org.apache.catalina.ant.DeployTask;

public class TestWarFileDeployment {

public static void deployWARFile()
{
DeployTask dt = new DeployTask();
dt.setUrl("http://localhost:8080/manager/html");
dt.setUsername("tomcat");
dt.setPassword("tomcat");
dt.setPath("/test");
dt.setWar("file :/test.war");

dt.execute();
}

public static void main(String args[])
{
deployWARFile();
}
}


When I compile and run this program to install the test.war file via Java program + Ant task I am getting the following exception. Do I need to set anything else? / Anything am I missing?


Exception in thread "main" java.lang.NullPointerException
at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:278)
at org.apache.catalina.ant.DeployTask.execute(DeployTask.java:146)
at com.ssaglobal.TestFramework.TestWarFileDeployment.deployWARFile(TestWarFileDeployment.java:31)
at com.ssaglobal.TestFramework.TestWarFileDeployment.main(TestWarFileDeployment.java:37)
Caused by: java.lang.NullPointerException
at org.apache.tools.ant.Task.log(Task.java:302)
at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:259)
... 3 more
--- Nested Exception ---
java.lang.NullPointerException
at org.apache.tools.ant.Task.log(Task.java:302)
at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:259)
at org.apache.catalina.ant.DeployTask.execute(DeployTask.java:146)
at com.ssaglobal.TestFramework.TestWarFileDeployment.deployWARFile(TestWarFileDeployment.java:31)
at com.ssaglobal.TestFramework.TestWarFileDeployment.main(TestWarFileDeployment.java:37)


Thanks
Srinivas Ivaturi.
 
Srinivas Ivaturi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can somebody help me out in that problem???
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your task should extends the ant Task class.
http://bobcat.webappcabaret.net/javachina/faq/ant_01.htm#ant_abc_Q07
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic