CAST Management Studio - Launching CAST MS - Fatal Error - Internal error occurred The application is closing

Purpose (problem description)

While opening CAST- MS, it fails with the error “Internal error occurred. The application is closing. Call CAST support now providing the log file at C:\Users\XXXX\AppData\Local\Temp\CAST\CAST\7.3\CAST-MS.log.txt”.

Observed in CAST AIP

ReleaseYes/No
8.3.x

Observed on RDBMS

RDBMSYes/No
CSS

Step by Step scenario

  1. Open CAST MS
  2. Select any Management database.
  3. It fails.

  1. If the error message is as below navigate to Point 6

Action Plan

  1. Open the CAST-MS log file

  2. Search for the error message The application is closing. Call CAST support now providing the log file.

  3. In the stack trace, check if the following message appears : java.lang.NullPointerException:null like below

ERR: 2015-04-10 10:37:21: Internal error occurred. The application is closing. Call CAST support now providing the log file at C:\Users\xxxxxx\AppData\Local\Temp\2\CAST\CAST\7.3\CAST-MS.log.txt com.castsoftware.java.MessageRuntimeException:Internal error occurred. The application is closing. Call CAST support now providing the log file at C:\Users\xxxxxxx\AppData\Local\Temp\2\CAST\CAST\7.3\CAST-MS.log.txt com.castsoftware.java.IOMonitor.fail(IOMonitor.java:252) com.castsoftware.java.IOMonitor.throwGeneralError(IOMonitor.java:194) com.castsoftware.mda.run.ConfiguredApplication$2.call(ConfiguredApplication.java:251) … java.lang.NullPointerException java.lang.NullPointerException:null com.castsoftware.amt.metamodel.impl.MetaModelSqlBuilder.build(MetaModelSqlBuilder.java:189) com.castsoftware.amt.metamodel.MetaModelManager.readMetaModel(MetaModelManager.java:99) com.castsoftware.amt.metamodel.AMTModelManager.init(AMTModelManager.java:118) com.castsoftware.pmc.run.PMCConfiguredApplication.onTreatment(PMCConfiguredApplication.java:332)


   1. If the following message appears just below the java.lang.NullPointerException:null: **com.castsoftware.amt.metamodel.impl.MetaModelSqlBuilder.** the issue is due to inconsistencies in the metamodel.
   2. Visit the page [CMS Assessment model - AMT Inconsistency - Information - Fix duplicate categories or types or properties - CAST Internal](https://doc-legacy.castsoftware.com/display/TKF/CMS+Assessment+model+-+AMT+Inconsistency+-+Information+-+Fix+duplicate+categories+or+types+or+properties+-+CAST+Internal) and follow the instruction to clean metamodel.
   3. Connect to CAST-MS again.
4. In the stack traces, if the following message appears : **java.lang.RuntimeException:internalException** like below :

   ```xml
The application is closing. Call CAST support now providing the log file at C:\Users\xxxxx\AppData\Local\Temp\2\CAST\CAST\8.1\CAST-MS6.log.txt 
com.castsoftware.java.MessageRuntimeException:Internal error occurred. 
The application is closing. Call CAST support now providing the log file at C:\Users\xxxxx\AppData\Local\Temp\2\CAST\CAST\8.1\CAST-MS6.log.txt 
com.castsoftware.java.IOMonitor.fail(IOMonitor.java:252) 
com.castsoftware.java.IOMonitor.throwGeneralError(IOMonitor.java:194) 
... 
internalException 
java.lang.RuntimeException:internalException 
com.castsoftware.java.Monitor.failInternal(Monitor.java:27) 
com.castsoftware.mda.impl.MemoryField.setPhysicalValue(MemoryField.java:942) 
com.castsoftware.mda.impl.MemoryField.setValue(MemoryField.java:864) 
com.castsoftware.mda.dbrefactor.FullEntityLoader.loadEntityField(FullEntityLoader.java:277) 
com.castsoftware.mda.dbrefactor.FullEntityLoader.load(FullEntityLoader.java:370)
  1. If the 2 following messages appear just below the java.lang.RuntimeException:internalException :

com.castsoftware.java.Monitor.failInternal(Monitor.java:27) com.castsoftware.mda.impl.MemoryField.setPhysicalValue(MemoryField.java:942)

   2. On the Management Database create the function MAINT\_UpdateApplicationID as shown below :

      ```sql
CREATE OR REPLACE FUNCTION MAINT_UpdateApplicationID(I_ApplicationID int)
RETURNS int AS 
$body$
declare 
	L_ApplicationID int;
	L_STMT varchar(100);
	L_STMT_SET varchar(200);
    L_TableName varchar(128);

begin
    L_ApplicationID := I_ApplicationID;
  
	select CMS_GET_CURRENT_OBJECT_ID (L_ApplicationID, 1) into L_ApplicationID;

	update  CMS_PORTF_Application
	set Object_ID = L_ApplicationID
	where Object_ID = I_ApplicationID;

	update  CMS_DynamicFields
	set Object_ID = L_ApplicationID
	where Object_ID = I_ApplicationID;

	update CMS_SystemCollections  
	set Object_ID = L_ApplicationID
	where Object_ID = I_ApplicationID;

	update CMS_ObjectLinks  
	set Caller_ID = L_ApplicationID
	where Caller_ID = I_ApplicationID; 
	
	update CMS_ObjectLinks  
	set Callee_ID = L_ApplicationID
	where Callee_ID = I_ApplicationID; 

	L_STMT_SET := ' set Application_ID = ' || L_ApplicationID ;
	L_STMT_SET := L_STMT_SET || ' where Application_ID = ' || I_ApplicationID;
	
   <<ProcessUpdateColumnApplicationID>>
	Declare ProcessUpdate Cursor For 
		  select table_name
			from information_schema.columns 
		   where column_name = 'application_id'
		     and is_updatable = 'YES'
			 and table_schema = current_schema
			order by table_name
		  For Read Only;
	begin
		Open ProcessUpdate;
		Fetch ProcessUpdate Into L_TableName;
		While (L_TableName is not null) loop
		  L_STMT := 'update '|| L_TableName  ; 
		  L_STMT := L_STMT || L_STMT_SET ;
		  
		  execute L_STMT;
		  
		  Fetch ProcessUpdate Into L_TableName;
		end loop;

		close ProcessUpdate;
	end	ProcessUpdateColumnApplicationID;
	 
	

	
    return L_ApplicationID ;   
end;
$body$ 
LANGUAGE 'plpgsql'
  1. Run the below query to get the object ids of the application :

SELECT object_id, object_name FROM cms_portf_application


      ![](https://doc-data.castsoftware.com/TG/attachments/566531412/566531413.png)
   4. Run the following function for object id of each application.

      ```sql
select MAINT_UpdateApplicationID(<Object_ID>);
  1. Open CAST Management Studio again.
  2. The error can occur because of many programs(processes) running on the System. So CAST - MS cannot open the window.  The issue can be resolved by following the below steps:
    1. Close all the programs/Stop all the processes running on the system.
    2. Restart the system
    3. Open CAST - MS
  3. The log will show messages like below -
Using arguments:
WRN: 2021-05-18 15:41:54: Duplicate translation for id cast.commandLine.executionFinished
WRN: 2021-05-18 15:41:54: Duplicate translation for id CONNECTION_MANAGER_DB_TYPE_ERROR
INF: 2021-05-18 15:41:54: Loading ini file: C:\Program Files\CAST\8.3\CastGlobalSettings.ini
ERR: 2021-05-18 15:41:56: Internal error occurred.
The application is closing. Call CAST support now providing the log file at C:\ProgramData\CAST\CAST\Logs\CAST-MS-20210518-154151.log.txt
com.castsoftware.java.MessageRuntimeException:Internal error occurred.
The application is closing. Call CAST support now providing the log file at C:\ProgramData\CAST\CAST\Logs\CAST-MS-20210518-154151.log.txt
com.castsoftware.java.IOMonitor.fail(IOMonitor.java:252)
com.castsoftware.java.IOMonitor.throwGeneralError(IOMonitor.java:194)
com.castsoftware.mda.run.ConfiguredApplication$2.call(ConfiguredApplication.java:257)
com.castsoftware.mda.run.ConfiguredApplication$2.call(ConfiguredApplication.java:234)
com.castsoftware.util.logger.Logging.execute(Logging.java:527)
com.castsoftware.util.logger.Logging.runInNewContext(Logging.java:415)
com.castsoftware.mda.run.ConfiguredApplication.run(ConfiguredApplication.java:233)
com.castsoftware.pmc.workbench.Application.start(Application.java:47)
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
org.eclipse.equinox.launcher.Main.run(Main.java:1407)
com.castsoftware.mda.ui.rcp.launchers.AbstractLauncher.launch(AbstractLauncher.java:78)
com.castsoftware.pmc.UI$1.call(UI.java:47)
com.castsoftware.pmc.UI$1.call(UI.java:35)
com.castsoftware.util.logger.Logging.execute(Logging.java:527)
com.castsoftware.util.logger.Logging.runInNewContext(Logging.java:415)
com.castsoftware.pmc.UI.main(UI.java:34)
EntityType "connectionProfilePostgres" not found
com.castsoftware.java.MessageRuntimeException:EntityType "connectionProfilePostgres" not found
com.castsoftware.mda.MDAMonitor.throwRuntimeException(MDAMonitor.java:154)
com.castsoftware.mda.MDAMonitor.throwEntityTypeNotFound(MDAMonitor.java:105)
com.castsoftware.mda.transfer.LotLoader.getEntityType(LotLoader.java:474)
com.castsoftware.mda.transfer.LotLoader.loadMultipleValue(LotLoader.java:364)
com.castsoftware.mda.transfer.LotLoader$1ValueLoader.hasNext(LotLoader.java:215)
com.castsoftware.mda.impl.MemoryField.mergeValues(MemoryField.java:1009)
com.castsoftware.mda.impl.EntityAccessor.mergeEntities(EntityAccessor.java:234)
com.castsoftware.mda.Entity.mergeEntities(Entity.java:205)
com.castsoftware.mda.transfer.LotLoader.loadFields(LotLoader.java:251)
com.castsoftware.mda.transfer.LotLoader.loadEntityValues(LotLoader.java:179)
com.castsoftware.mda.transfer.LotLoader.loadSingleton(LotLoader.java:123)
com.castsoftware.mda.transfer.LotLoader.loadSingleton(LotLoader.java:101)
com.castsoftware.mda.transfer.LotLoader.loadLot(LotLoader.java:69)
com.castsoftware.mda.transfer.FileLoader.load(FileLoader.java:528)
com.castsoftware.mda.transfer.FileLoader.loadDocument(FileLoader.java:389)
com.castsoftware.mda.transfer.FileLoader.tryLoadDocument(FileLoader.java:329)
com.castsoftware.mda.transfer.FileLoader.load(FileLoader.java:315)
com.castsoftware.mda.transfer.FileLoader.run(FileLoader.java:288)
com.castsoftware.pmc.base.connectionprofiles.Persistence.load(Persistence.java:170)
com.castsoftware.pmc.ui.connection.PmcConnectionUIHelper.checkAndSelectConnection(PmcConnectionUIHelper.java:93)
com.castsoftware.pmc.workbench.Application$WorkbenchPMCConfiguredApplication.buildConnection(Application.java:115)
com.castsoftware.pmc.run.PMCConfiguredApplication.onTreatment(PMCConfiguredApplication.java:422)
com.castsoftware.pmc.workbench.Application$WorkbenchPMCConfiguredApplication.onTreatment(Application.java:121)
com.castsoftware.mda.run.ConfiguredApplication$2.call(ConfiguredApplication.java:244)
com.castsoftware.mda.run.ConfiguredApplication$2.call(ConfiguredApplication.java:234)
com.castsoftware.util.logger.Logging.execute(Logging.java:527)
com.castsoftware.util.logger.Logging.runInNewContext(Logging.java:415)
com.castsoftware.mda.run.ConfiguredApplication.run(ConfiguredApplication.java:233)
com.castsoftware.pmc.workbench.Application.start(Application.java:47)
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
org.eclipse.equinox.launcher.Main.run(Main.java:1407)
com.castsoftware.mda.ui.rcp.launchers.AbstractLauncher.launch(AbstractLauncher.java:78)
com.castsoftware.pmc.UI$1.call(UI.java:47)
com.castsoftware.pmc.UI$1.call(UI.java:35)
com.castsoftware.util.logger.Logging.execute(Logging.java:527)
com.castsoftware.util.logger.Logging.runInNewContext(Logging.java:415)
com.castsoftware.pmc.UI.main(UI.java:34)

The issue is coming up because your current CAST Installation is corrupt.

To solve the issue, you need to re-install CAST AIP.

    7. If the above points do not help you to solve the issue contact CAST Technical Support with the following relevant input.

Related Pages

Webcall :  30004

Ticket : 9935

Ticket: 29612