How to start weblogic server using ANT tasks.

Discussions

EJB design: How to start weblogic server using ANT tasks.

  1. Hi ,
    Can I start my weblogic server using ANT tasks.

    I have tried this as ,

    <target name="start-server">
    <wlserver dir="${Domain_Home}/config" host="${SAG_WLS_SERVER_URL}"
    port="${SAG_WLS_SERVER_PORT}" action="start"/>
    </target>

    But it throws error...as follows


    start-server:

    BUILD FAILED
    java.lang.NullPointerException
            at weblogic.Home.<init>(Home.java:29)
            at weblogic.Home.getInstance(Home.java:86)
            at weblogic.Home.getPath(Home.java:94)
            at weblogic.Home.getFile(Home.java:99)
            at weblogic.ant.taskdefs.management.WLServer.execute(WLServer.java:274)
            at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:302)
            at org.apache.tools.ant.Task.perform(Task.java:401)
            at org.apache.tools.ant.Target.execute(Target.java:338)
            at org.apache.tools.ant.Target.performTasks(Target.java:365)
            at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
            at org.apache.tools.ant.Project.executeTargets(Project.java:1094)
            at org.apache.tools.ant.Main.runBuild(Main.java:669)
            at org.apache.tools.ant.Main.startAnt(Main.java:220)
            at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
            at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)


    can anyone help me...?
  2. I don't know wlserver ant task, but you can always use ant's exec task and pass a shell cmd to it. For example
    if it is a Unix platform, you can use startWeblogic.sh; if it is a Windows platform, you can use startWeblogic.cmd.

    Hope this helps.
  3. Do you have a <taskdef> tag for wlserver? Is weblogic.jar in ANTs classpath?
  4. yeah...I have <taskdef> wlserver...Still it throws error

    <path id="weblogic.classes">
    <pathelement location="${WEBLOGIC_HOME}/lib/weblogic.jar" />
    </path>

    <taskdef name="wlserver" classname="weblogic.ant.taskdefs.management.WLServer">
    <classpath>
    <path refid="weblogic.classes" />
    </classpath>
    </taskdef>
  5. For Posterity[ Go to top ]

    I came across this when I tried running Weblogic ANT tasks from within my IntelliJ IDEA.

    The issue was resolved when I added weblogic.jar to CLASSPATH ('Additional Classpath' tab of the Ant Properties).

    Thanks,
    Binil
  6. Just run this cmd file located at
     %WL_HOME%\server\bin\setWLSEnv in the same shell before the wlserver task is used. then the error that you are getting wont be seen.