Starting a weblogic Managed server with ant tasks

Discussions

EJB design: Starting a weblogic Managed server with ant tasks

  1. Hi,

           I am trying to start a weblogic Managed server with ant tasks and run it as a service.But I could not do it as a service.

     If I use
    <target name="start-server">
    <wlserver dir="${Domain_Home}/config" host="${SAG_WLS_SERVER_URL}"
    port="${SAG_WLS_SERVER_PORT}" action="start" adminserverurl="admin_server_url" />
    </target> the server is starting in the command prompt where I am running this command.

          So could anyone please help me in starting the server as a service.

    Thanks in advance,
    Surendra
  2. Make sure that the nodemanager is up and running. Only when the nodemanager is running can u issue start and stop commands to it. It is the nodemanager that starts the managed servers on the appropriate machine the server is hosted on. Here is what I did to get it to work. Note that this ant script ends immediately and the actual servers start up on the target machine.

        <target name="StartManagedServer" description="Starts a managed server">
    <!--Need to invoke lookupNodeManagerRuntime before we can look up the runtime mbean -->
    <java classname="weblogic.Admin" failonerror="false" fork="true">
      <arg line="-url ${adminURL}" />
                    <arg line=" INVOKE" />
                    <arg line="-mbean ${domainName}:Name=${MachineToRun},Type=Machine" />
    <arg line="-method lookupNodeManagerRuntime" />
    </java>

          <!-- Lookup the NodeManagerRuntimeMBean and give the command to start it. -->
    <java classname="weblogic.Admin" failonerror="false" fork="true">
      <arg line="-url ${adminURL}" />
                    <arg line=" INVOKE" />
                    <arg line="-mbean ${domainName}:Location=${AdminServerName},Name=${MachineToRun},ServerRuntime=${AdminServerName},Type=NodeManagerRuntime" />
    <arg line="-method start ${domainName}:Name=${ManagedServerName},Type=Server" />
    </java>
        </target>