FortiSIEM
FortiSIEM provides Security Information and Event Management (SIEM) and User and Entity Behavior Analytics (UEBA)
kdave
Staff
Staff
Article Id 390983
Description This article describes how to resolve the AppSvr error 'Unable to build Hibernate SessionFactory', which occurs during an upgrade.
Scope FortiSIEM.
Solution

While performing an upgrade, the upgrade fails, and the following errors have been observed in the upgrade logs.

 

Log location: /usr/local/upgrade/logs/ansible.log

[1;31m[13:23:17] ↳ appserver : APPSERVER | Deploying EAR file into glassfish domain1 using the standard approach ...| localhost | FAILED | 1m1s

{

- stdout: Command deploy failed.

- rc: 1

- stderr: remote failure: Error occurred during deployment: Exception while preparing the app : [PersistenceUnit: phoenixDB] Unable to build Hibernate SessionFactory. Please see server.log for more details.

Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method : javax.persistence.PersistenceException: [PersistenceUnit: phoenixDB] Unable to build Hibernate SessionFactory

[PersistenceUnit: phoenixDB] Unable to build Hibernate SessionFactory

.....

- stderr_lines: [

- remote failure: Error occurred during deployment: Exception while preparing the app : [PersistenceUnit: phoenixDB] Unable to build Hibernate SessionFactory. Please see server.log for more details.

- Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method : javax.persistence.PersistenceException: [PersistenceUnit: phoenixDB] Unable to build Hibernate SessionFactory

- [PersistenceUnit: phoenixDB] Unable to build Hibernate SessionFactory

 

There are multiple methods to resolve this error during the upgrade.

 

Method 1:

  • Make sure that the following entry exist in /etc/hosts file. If it does not exist, manually add the entry:

 

profile.on dbvip
X.X.X.X dbleader.fsiem.fortinet.com

X.X.X.X is IP Address of Supervisor, replace it with actual IP of Supervisor
end

 

  • Resume the upgrade from the step where it failed previously.

 

cd /usr/local/upgrade

ansible-playbook post-upgrade.yml --start-at-task="<task_name>" | tee -a /usr/local/upgrade/logs/ansible_continued_upgrade.log

 

The 'task_name' can be found with the following command:

 

ansible-playbook --list-task post-upgrade.yml

 

Method 2:

  • The /tmp/passwords.txt file must contain the existing Database Password.

 

cat /tmp/passwords.txt

 

  • Note down the password value:


cp /opt/glassfish/domains/domain1/config/domain.xml /opt/glassfish/domains/domain1/config/domain.xml.backup


vi /opt/glassfish/domains/domain1/config/domain.xml

Locate the following line:

<property name="password" value="${ALIAS=phdbpwd}"></property>

 

Change it to <password_as_noted_above> without <,>.

 

<property name="password" value="<password_as_noted_above>"></property>

Save the file:

  • Redeploy the AppSvr.


su admin
cd /opt/phoenix/deployment
./deploy-fresh.sh phoenix.ear

 

  • After AppSvr has redeployed successfully, continue the upgrade:

 

   cd /usr/local/upgrade

ansible-playbook post-upgrade.yml --start-at-task="<task_name>" | tee -a /usr/local/upgrade/logs/ansible_continued_upgrade.log
task_name can be found using below command.
ansible-playbook --list-task post-upgrade.yml

 

  • Once the upgrade task gets completed, reboot the instance.
  • Check if all of the processes are up and running once the instance has been rebooted.