Sun GlassFish Enterprise Server 2.1 Troubleshooting Guide

Starting and Stopping a Node Agent

To create a service that starts and stops the node agent agent1, run the following command:

C:\\windows\\system32\\sc.exe create agent1 binPath= "C:\\Sun\\AppServer\\
lib\\appservAgentService.exe \\"C:\\Sun\\AppServer\\bin\\asadmin.bat 
start-node-agent --user admin --passwordfile C:\\Sun\\AppServer\\
password.txt agent1\\" \\"C:\\Sun\\AppServer\\bin\\asadmin.bat 
stop-node-agent agent1\\"" start=auto DisplayName="SJESAS_SE8.1 AGENT1"

Note –

The start and stop commands entered as part of the binPath= parameter must have the correct syntax. To test, run the commands from the command prompt. If the commands do not properly start or stop the domain or node agent, the service will not work correctly.

Also, do not use a mixture of asadmin start and stop commands and service start and stops. Mixing the two can cause the server status to be out of sync. For example, the service might not show that the component has started even though the component is not running. To avoid this situation, always use the sc.exe command to start and stop the component when using services.