Set background applications using scripting


We can enable or disable a background application using scripting and wsadmin.

Background applications specify whether the application must initialize fully before the server starts. The default setting is false and this indicates that server startup will not complete until the application starts. If we set the value to true, the application starts on a background thread and server startup continues without waiting for the application to start. The application may not ready for use when the appserver starts.

 

  1. Launch the wsadmin scripting tool using the Jython scripting language.

  2. Locate the application deployment object for the application. For example:

    • Jacl...

      set applicationDeployment [$AdminConfig getid /Deployment:adminconsole/ApplicationDeployment:/]

    • Jython...

      applicationDeployment = AdminConfig.getid('/Deployment:adminconsole/ApplicationDeployment:/')


    Table 1. getid command elements

    set Jacl command
    applicationDeployment variable name
    $ Jacl operator for substituting a variable name with its value
    AdminConfig object that represents the WAS configuration
    getid AdminConfig command
    Deployment type
    ApplicationDeployment type
    adminconsole is the name of the application

  3. Enable the background application. For example:

    • Jacl...

      $AdminConfig modify $applicationDeployment "{backgroundApplication true}"

    • Jython...

      AdminConfig.modify(applicationDeployment, ['backgroundApplication', 'true'])


    Table 2. modify command elements

    $ Jacl operator for substituting a variable name with its value
    AdminConfig object that represents the WAS configuration
    modify AdminConfig command
    applicationDeployment variable name that was set in step 1
    backgroundApplication attribute
    true is the value of the backgroundApplication attribute

  4. Save the configuration changes...

    AdminConfig.save()

  5. Synchronize the node.

    Use the syncActiveNode or syncNode scripts in the AdminNodeManagement script library to propagate the configuration changes to node or nodes.

    • Use the syncActiveNodes script to propagate the changes to each node in the cell...

      AdminNodeManagement.syncActiveNodes()

    • Use the syncNode script to propagate the changes to a specific node, as the following example demonstrates:

      AdminNodeManagement.syncNode("myNode")

 

Related tasks


Set application startup
Use the AdminConfig object for scripted administration

 

Related


Commands for the AdminConfig object