com.adventnet.mfw.ServerFailureException that can be resolved with initPgsql script with administrator privileges

com.adventnet.mfw.ServerFailureException that can be resolved with initPgsql script with administrator privileges

      During startup or upgrade, in some of the environments, users are facing the postgresql startup failure issue with the below trace.

Dec 21, 2023 2:49:46 PM  [com.adventnet.persistence.PersistenceInitializer]  [SEVERE] : Please login to the system as <server>\<user> and execute initPgsql.bat script with administrator privileges. If issue is not yet solved, please contact support.com.adventnet.mfw.ServerFailureException: Please login to the system as SGSDPLUS001\sotong and execute initPgsql.bat script with administrator privileges. If issue is not yet solved, please contact support.
	at com.adventnet.db.adapter.postgres.DefaultPostgresDBInitializer.startDBServer(DefaultPostgresDBInitializer.java:212)
	at com.adventnet.db.adapter.postgres.PostgresDBAdapter.startAndCheckDBServer(PostgresDBAdapter.java:808)
	at com.adventnet.db.adapter.postgres.PostgresDBAdapter.setUpDB(PostgresDBAdapter.java:791)
	at com.adventnet.persistence.PersistenceInitializer.startDB(PersistenceInitializer.java:1477)
	at com.adventnet.persistence.PersistenceInitializer.startDB(PersistenceInitializer.java:1440)
	at com.adventnet.persistence.PersistenceInitializer.initializeDB(PersistenceInitializer.java:705)
	at com.adventnet.persistence.DefaultPatchValidator.allowPatchUpgrade(DefaultPatchValidator.java:133)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.adventnet.tools.update.installer.PreProcessor.invokeCustomSPValidation(PreProcessor.java:186)
	at com.adventnet.tools.update.installer.Common.install(Common.java:309)
	at com.adventnet.tools.update.installer.UpdateManagerUI.validateTheFile(UpdateManagerUI.java:1360)
	at com.adventnet.tools.update.installer.UpdateManagerUI$BrowsePatchButtonAction$1.run(UpdateManagerUI.java:1343)
	at java.lang.Thread.run(Thread.java:750)

Dec 21, 2023 2:49:46 PM  [com.adventnet.persistence.PersistenceInitializer]  [SEVERE] : Problem while starting Database due to:Please login to the system as SGSDPLUS001\sotong and execute initPgsql.bat script with administrator privileges. If issue is not yet solved, please contact support.
Dec 21, 2023 2:49:46 PM  [SYSERR]  [INFO] : java.lang.RuntimeException: Please login to the system as <server>\<user> and execute initPgsql.bat script with administrator privileges. If issue is not yet solved, please contact support.


This trace is encountered, if there is any problem in starting the postgres database. The causes for startup may differ as explained in the following cases.

Case 1 : 

Dec 21, 2023 2:45:03 PM  [com.adventnet.db.adapter.postgres.DefaultPostgresDBInitializer]  [INFO] : Command to be executed [C:\ManageEngine\ServiceDesk\pgsql\bin\pg_ctl.exe, -w, -D, C:\ManageEngine\ServiceDesk\pgsql\data, -o, "-p65432", start] 
Dec 21, 2023 2:46:03 PM  [pglog]  [INFO] : waiting for server to start............................................................... stopped waiting
Dec 21, 2023 2:46:03 PM  [pglog]  [INFO] : pg_ctl: server did not start in time

Cause : 
  1. Environmental Issue
  2. Antivirus/Windows Defender Intervention 
Resolution :
  1. We can resolve this issue by excluding servicedeskplus folder from the Antivirus/Windows Defender Intervention and For a safer side, ensuring no other process is running inside the <ServiceDeskPlus> directory before starting up.


Case 2 :
.
Dec 21, 2023 2:45:10 PM  [com.adventnet.db.adapter.postgres.DefaultPostgresDBInitializer]  [INFO] : Command to be executed [C:\ManageEngine\ServiceDesk\pgsql\bin\pg_ctl.exe, -w, -D, C:\ManageEngine\ServiceDesk\pgsql\data, -o, "-p65432", start] 
Dec 21, 2023 2:47:52 PM  [pglog]  [INFO] : 2023-12-21 14:47:52 +08[0]:[10704]:[1]FATAL:  could not create lock file "postmaster.pid": Permission denied
Dec 21, 2023 2:48:20 PM  [pglog]  [INFO] : waiting for server to start............................................................... stopped waiting
Dec 21, 2023 2:48:20 PM  [pglog]  [INFO] : pg_ctl: server did not start in time

Cause :
This may happen due to a number of factory like, 
  1. Insufficient permissions for the user, trying to execute this command (in your case, it will be the user with which you had opened command prompt)
  2. File system errors or corrupted postmaster.id file
Resolution :
  1. In the first hand, we can try running "initPgsql" script in <ServiceDeskplus_install_folder> / bin directory and ensure no failures are there while running script. 
  2. If the issue doesn't resolves even after this case, check whether the mentioned file is corrupted.  If corrupted, Reach our support with the pgsql folder and screenshot that shows the result of "initPgsql" script.

                    New to ADSelfService Plus?