Category: Glassfish


Suitable for:

  • Glassfish Application Server V2.1
  • Windows XP

In a production environment we want Glassfish Application Server to be running with no users logged into the host machine (WinXP in this case). This post explains how to run Glassfish as a service which will automatically start up when the host machine is rebooted.

To create the service:

>sc create domain1 binPath= "C:\Sun\AppServer\lib\appservService.exe \"C:\Sun\AppServer\bin\asadmin.bat start-domain\" \"C:\Sun\AppServer\bin\asadmin.bat stop-domain\""

To check that the service has been successfully created right click on My Computer –> Manage –> Services and Applications -> Services. The service domain1 should appear in the list. Right click on the service –>Properties –> change the startup type to be Automatic and select Apply, then OK. The service should run as Local System (default).

If you need to remove the service, run the following command (make sure the Computer Management window is closed first):

sc delete domain1

Note. Glassfish can be controlled by the command line, through an IDE or as a service. It is not recommended to mix these approaches when stopping and starting the server.

Recently I started noticing this irritating message (repeated multiple times) in my NetBeans Glassfish Application Server log. The message is triggered by Glassfish start up and on application deployment.

SEC5046: Audit: Authentication refused for [admin].
Web login failed: Login failed: javax.security.auth.login.LoginException: Failed file login for admin.

It annoys me because when I installed NetBeans, I specified my own admin password for Glassfish (instead of the default admin/adminadmin). Later when starting the Glassfish server through NetBeans, it prompts me for my password and I supply it yet stubbornly this message continues to appear in my log. What the hell NetBeans?

So I’ll admit I ignored it for a while.

Today, I fixed it. I simply went into the Glassfish admin console (http://localhost:4848) and changed the Administrator’s password to the one specified during NetBeans installation. I restarted Glassfish and what do you know the message is no more.