Hi,

Jay SenSharma

Jay SenSharma

WebLogic APIs provides many Container specific ANT implementation classes  which can be used to simplify and automate many Server related Tasks…Here we are going to see the use of “weblogic.ant.taskdefs.management.WLServer”

Here is a Simple Ant Scripts which we can use to Start and Stop the WebLogic Server. You can even specify the JVM Arguments inside this ANT script to set the Heap Size and the MaxPermSize…etc parameters…

build.xml

<project name="start-stop-Server" default="startserver">
<property name="bea.home" value="C:bea103" />
<property name="weblogic.home" value="C:bea103wlserver_10.3" />
<property name="domain.home" value="C:bea103user_projectsdomains" />
<property name="domain.name" value="7001_Domain" />
<property name="host" value="localhost" />
<property name="port" value="7001" />
<property name="username" value="weblogic" />
<property name="password" value="weblogic" />
<property name="admin.server.name" value="AdminServer" />

<path id="wls.classpath">
    <fileset dir="${weblogic.home}/server/lib">
        <include name="web*.jar"/>
    </fileset>
</path>

<taskdef name="wlserver" classname="weblogic.ant.taskdefs.management.WLServer" classpathref="wls.classpath"/>

<target name="startserver" >
  <wlserver dir="${domain.home}/${domain.name}" host="${host}" port="${port}"
            domainname="${domain.name}" servername="${admin.server.name}"
            action="start" username="${username}" password="${password}"
            beahome="${bea.home}" weblogichome="${weblogic.home}" verbose="true"  noexit="true"
            protocol="t3" classpath="${weblogic.home}/server/lib/weblogic.jar" >
                       <jvmarg value="-server"/>
	               <jvmarg value="-Xms256m"/>
	               <jvmarg value="-Xmx512m"/>
	               <jvmarg value="-XX:PermSize=128m"/>
                       <jvmarg value="-XX:MaxPermSize=256m"/>
   </wlserver>
</target>

<target name="stopserver">
  <wlserver dir="${domain.home}/${domain.name}" host="${host}" port="${port}"
            servername="${admin.server.name}" username="${username}" password="${password}"
            action="shutdown" beahome="${bea.home}" weblogichome="${weblogic.home}" forceshutdown="true"/>
</target>

</project>

NOTE set the PATH and JAVA_HOME like following:

F:SUCCESS>set PATH=c:bea103jdk160_05bin;C:bea103modulesorg.apache.ant_1.6.5bin;%PATH%
F:SUCCESS>set JAVA_HOME=C:bea103jdk160_05
F:SUCCESS>ant    startserver    -verbose

Output:

Starting WebLogic Server Using ANT

Starting WebLogic Server Using ANT

.

.

Thanks

Jay SenSharma

If you enjoyed this post, please considerleaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.