antweblogic9.x

How to Pass Username and Password asked in exec task of ant after running startManagedWebLogic.cmd during runtime?


<target name="startmanaged" description="Start Managed Server">
   <if>
      <equals arg1="${server-host}" arg2="localhost" />
          <then>
            <echo message="__________  Check Weblogic" />
            <if>
              <available file="${weblogic}"/>
                <then>
                   <echo message="Weblogic server found" />
           <echo message="__________ Starting managed Weblogic server" />
            <property name="weblogic.console" value="http://${host}:${port}/console"/>
                <exec dir="${weblogic.domain.dir}/bin" executable="cmd.exe" failonerror="true">
                      <arg line="/C ${weblogic.domain.dir}/bin/${start-managed-server} ${server1} ${adminURL}"/>
                 </exec>
                </then>
              <else>
                  <fail message="No Weblogic server has been found" />
              </else>
            </if>
         </then>
       </if>
</target>

How to pass username and password asked after running this ANT script at runtime through ANT Script?


Solution

  • Look in the startManagedWebLogic.sh file itself:

    Set WLS_USER equal to your system username and WLS_PW equal to your system password for no username and password prompt during server startup. Both are required to bypass the startup prompt.

    There are also other methods described here in the bypass prompt section: http://docs.oracle.com/cd/E13222_01/wls/docs70/adminguide/startstop.html

    You can setup a boot.properties file or add the java options:

    -Dweblogic.management.username=username
    -Dweblogic.management.password=password