Deployment

Not all the questions on this page are directly related to Canvas deployment, e.g. questions on Oracle database. Some of these questions were asked by participants during the Canvas training sessions. We have answered those here for the larger benefit of the Canvas Developer community.

 How to connect to Oracle database through command prompt?
  1. At command prompt, type sqlplus and press ENTER.
  2. Enter the DBA User ID and press ENTER.
  3. Enter the DBA User Password and press ENTER.

    Connecting to Oracle Database

    If the credentials are correct the connection to Oracle database will be successful.
 How to find out the Oracle System ID (SID)?
  1. After successfully connecting to the Oracle database at the command prompt as suggested in previous question, enter the following command:

    show parameter service_name
  2. In the result, the VALUE column displays the Oracle SID.

    Finding Oracle SID
 What to update in the ‘config.txt’ file for deploying Canvas?

The ‘config.txt’ file contains the configuration details to connect to the database and execute the schema scripts of Canvas Technology framework. It is essential that you provide the correct DBA user ID and password in the ‘config.txt’ file to connect to the Oracle database. The Canvas schema scripts are executed on the connected database.

Updating config.txt file


 Why is the Canvas schema script running thrice when executing the ‘run.bat’ file?

It is because, by default the ‘run.bat’ file executes the schema scripts of CT ModelHouse, Expert Studio, and Wizard Studio. However, you can specify which scripts to be executed in the APP_LIST parameter in the 'config.txt' file by removing the unwanted schemas:

APP_LIST=ctmodelhouse, ctstudio/Expert, ctstudio/Wizard

# Here, ctmodelhouse is the schema for the sample application, ModelHouse, that is packaged with Canvas Framework.
# ctstudio/Expert is the schema for Canvas Expert Studio (Canvas Studio).
# ctstudio/Wizard is the schema for Canvas Wizard Studio.
 How to export a schema from Oracle 12c?

To export a schema from Oracle 12c database, perform the following:

  1. Connect to the Oracle 12c database and check the existing directories using the following SQL command:

    select * from all_directories;
  2. Export the required schema using the following SQL command:

    expdp dumpfile=<DumpFilename>.dmp logfile=<LogFilename>.log directory=<DirectoryName> schemas=<SCHEMA_NAME>;
    
    --Example:
    expdp dumpfile=CMS.dmp logfile=CMS.log directory=LOG_FILE_DIR schemas=CMS;
  3. Use the following syntax when prompted for user name:

    sys/<Password>@<Servicename>as sysdba
    
    --Example:
    sys/Password@pdborcl as sysdba
 How to connect to the schemas of CT ModelHouse, Expert Studio, and Wizard Studio in SQL Developer?
  1. Open Oracle SQL Developer.
  2. In the Connections tab on the left-hand side, right-click Connections and select New Connection.

    Creating new connection in SQL Developer

  3. In the New / Select Database Connection dialog box, enter the Connection Name. For example, to connect to Model schema, enter MODEL. (This value must be similar to the name of schema given in the ‘config.txt’ file)

    New Database Connection dialog box

  4. Enter the schema username and password in the Username and Password fields respectively. For example, for Model schema, enter MODEL / MODEL (These values must be similar to the values given in the ‘config.txt’ file)
  5. Ensure the correct Hostname, Port, and SID are given in the respective fields.
  6. Click Test. If the credentials are correct the connection to the schema will be successful.
  7. Click Connect.
  8. After schema connection is established, check if you are able to view the schemas contents.

    Viewing schema details in SQL Developer

 How to set environment variables for Java or Ant in the system?
  1. Open System Properties. (My Computer > Properties)
  2. In the Advanced tab, click Environment Variables.

    Advanced settings in System Properties

  3. In the User variables for section of Environment Variables dialog box, click New to create new variables. Ensure you create new variables for Java, Ant, Oracle as shown in the following screenshot:

    Environment Variables dialog box

  4. Edit the path variable and map the environment variables of Java and Ant as shown in the following screenshot. Ensure that the variables are mapped to the folder that contains the installed files of Java, Oracle, and Ant.

    Setting the Environment Variables

  5. Click OK.
  6. Click OK on the Environment Variables dialog box.
  7. To check if the environment variables are set correctly, at the command prompt check the version of Java installed on your system by entering the following command:

    java –version


    If the environment variables are set correctly, the version of Java installed on your system is displayed.

    Java version in Command Prompt

 How to start/stop Tomcat server manually without using Eclipse?
  1. To start the Tomcat server, double-click the startup.bat file in the Tomcat folder (e.g. ‘D:\Canvas\apache-tomcat-7.0.67\bin’).
  2. To stop the Tomcat server, press CTRL + C in the command prompt.
 What are the changes to be done when context root of the application is changed?

Let’s assume that the following are the details of the application: 

  • DATA_SOURCE_NAME : DliteCTDS
  • SCHEMA_NAME : CT_MIG
  • SCHEMA_NAME_PWD : CT_MIG
  • CONTEXT_ROOT : dliteweb
  • WAR_NAME : dliteweb
  • WORK_FOLDER : D:/Canvas19/dliteweb

As a sample reference, the following steps indicate the changes required for the JBoss app server and Oracle database environments. For other app server and database combinations, appropriate changes need to be done in the relevant files. 
Context Root changes

1. In the application WAR, in the JBoss folder, specify the context root in the \WEB-INF\jboss-web.xml file, as shown in the following code snippet:

<context-root> <CONTEXT_ROOT> </context-root>
<!-- For example -->
<context-root> dliteweb </context-root>

2. In the CTResources.jar, in the ....\Ctweb\Dependencies\Canvas\CTResources.jar\CanvasApplicationContext.json file, specify the context root, as shown in the following code snippet:

{
	"contextRoot": "<CONTEXT_ROOT>",
	"applicationId": "MODELHOUSE",
	"displayName": "CTWEB",
	"isService": "Y"
}
# For example
{
	"contextRoot": "dliteweb",
	"applicationId": "MODELHOUSE",
	"displayName": "CTWEB",
	"isService": "Y"
}

3. In the CtwebResource.jar, in the ....\Ctweb\CtwebResources\src\main\resource\Ctwebsecurityconfig.properties file, specify the default context root, as shown in the following code snippet: 

DEFAULT_CONTEXT_ROOT=/<CONTEXT_ROOT>
ALL_CONTEXT_ROOTS=<CONTEXT_ROOT>
<!-- For example -->
DEFAULT_CONTEXT_ROOT=dliteweb
ALL_CONTEXT_ROOTS=dliteweb

4. In the CtwebResource.jar, in the ....\CtwebResources\src\main\resource\Ctwebexportconfig.properties file, specify the context path, as shown in the following code snippet:

SESSION_TIMEOUT_URL=/<CONTEXT_ROOT>/index.jsp 
CONTEXT_PATH=/<CONTEXT_ROOT>
<!-- For example -->
SESSION_TIMEOUT_URL=dliteweb/index.jsp 
CONTEXT_PATH=dliteweb

JNDI Data source name change

1. In the CtwebResource.jar, in the ....\CtwebResources\src\main\resource\Ctwebdatabaseconfig.properties file, specify the JNDI data source name, as shown in the following code snippet:

CT_FW_DATASOURCE=java:/<DATA_SOURCE_NAME>
CT_FW_FILEIMPORT_DATASOURCE=java:/<DATA_SOURCE_NAME>
<!-- For example -->
CT_FW_DATASOURCE=java:/DliteCTDS 
CT_FW_FILEIMPORT_DATASOURCE=java:/DliteCTDS

2. In the application WAR, in the JBoss folder, specify the JNDI data source name in the ..../standalone/configuration/standalone.xml file, as shown in the following code snippet:

<datasource jndi-name="java:jboss/datasources/<DATA_SOURCE_NAME>" pool-name="<DATA_SOURCE_NAME>" enabled="true">
     <connection-url>jdbc:oracle:thin:@10.12.25.28:1521:SIR13714</connection-url>
     <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
     <driver>OracleJDBCDriver</driver>
     <security>
         <user-name><SCHEMA_NAME></user-name>
         <password><SCHEMA_NAME_PWD></password>
     </security>
</datasource>
<!-- For example -->
<datasource jndi-name="java:jboss/datasources/DliteCTDS" pool-name="DliteCTDS" enabled="true">
     <connection-url>jdbc:oracle:thin:@10.12.25.28:1521:SIR13714</connection-url>
     <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
     <driver>OracleJDBCDriver</driver>
     <security>
         <user-name>CT_MIG</user-name>
         <password>CT_MIG</password>
     </security>
</datasource>

3. In the application WAR, in the JBoss folder, specify the JNDI data source name in the \WEB-INF\jboss-web.xml file, as shown in the following code snippet:

<resource-ref>
   <res-ref-name>jdbc/CTwebCanvasDataSource</res-ref-name>
   <jndi-name>java:jboss/datasources/<DATA_SOURCE_NAME></jndi-name>
</resource-ref>
<!-- For example -->
<resource-ref>
   <res-ref-name>jdbc/CTwebCanvasDataSource</res-ref-name>
   <jndi-name>java:jboss/datasources/DliteCTDS</jndi-name>
</resource-ref>

Work Folder Changes

1. In the CtwebResource.jar, in the ....\CtwebResources\src\main\resource\CtwebImplementation.properties file, specify the work folder and centralized work folder paths, as shown in the following code snippet:

CT_WORK_FOLDER_PATH=<WORK_FOLDER>                
CT_WORK_CENTRALIZED_FOLDER_PATH=<WORK_FOLDER>   
<!-- For example -->
CT_WORK_FOLDER_PATH=D:/Canvas19/dliteweb                
CT_WORK_CENTRALIZED_FOLDER_PATH=D:/Canvas19/dliteweb

2. Specify the Web Application Resource (WAR) file name of the application in build.xml file, as shown in the following code snippet: 

<property name="WAR_FILE_NAME" value="${DIST_ROOT}/<WAR_NAME>.war" />
<!-- For example -->
<property name="dliteweb" value="${DIST_ROOT}/dliteweb.war" />
 Connection timeout issue while deploying application on JBOSS

Solution: Add following entry in the standalone.xml file:

<system-properties>
         <property name="jboss.as.management.blocking.timeout" value="600"/> 
  </system-properties>
 Application deployment fails when setting up in a new environment

Check for the following pattern in the error logs:

java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.ensureError(J9VMInternals.java:148)
at java.lang.J9VMInternals.recordInitializationFailure(J9VMInternals.java:137)
at io.bit3.jsass.Compiler.<init>(Compiler.java:40)
at com.intellectdesign.canvas.web.themes.ThemeConfig$CssConfig.convertScssFileToCssFie(ThemeConfig.java:817)

Solution: The SASS Java library does not support AIX operating system and hence the issue. This issue can be solved by performing the SASS compilation while generating the application WAR. Go through the following links to find samples of the ANT targets that must be included in the build file to perform the SASS compilation:

 Getting Heap Space or Out of Memory error

Check for the following pattern in the error logs: 

java.lang.OutOfMemoryError: Java heap space

Solution: Increase the memory to at least 8 GB. If the OutOfMemoryError still occurs, generate periodic heap dumps and analyse whether the heap usage is increasing.

 Application is not getting deployed

Check for the following pattern in the error logs:

SEVERE: [com.intellectdesign.canvas.config.ConfigurationManager] [CTCOM00095] : Error while initializing configuration

Solution: This pattern will be present in the CanvasConfig_<yyyyMMddkkmmss>_<appServerName>_<applicationName> in case there is an error while initializing the configuration required for CT. At the end of the stack trace check the root cause mentioned in the “Caused by: " section.

 Instead of updating the CanvasApplicationContext.json file, update web.xml in the 19.1.7.11 19679 revision and above.
  • If the latest release revision is 19.1.7.11 19679 and above, refer to the following steps:

Perform the following steps to use the CT release as-is without the need to update the CanvasApplicationContext.json file in the CTResources.jar.

  1. Update web.xml in the application WAR.

Example, File Location: ...\webapps\ctmodelhouse\WEB-INF\web.xml

The following snippet provides the sample values of the necessary elements and attributes that are to be configured within web.xml.

<context-param>
<param-name>appId</param-name>
<param-value>MODELHOUSE</param-value>
</context-param>

The param name should remain unchanged. Only "appId" should be used.

If the context-param attribute is already present in the web.xml for a different param-name, the new context-param attribute has to be added after that to configure the value of appId.

Refer to the following snippet for sample values of the necessary elements and attributes that are to be configured within web.xml.

<context-param>
<param-name>ModelHouseInitializeBundle</param-name>
<param-value>MyImplementation</param-value>
</context-param>
<context-param>
<param-name>appId</param-name>
<param-value>MODELHOUSE</param-value>
</context-param>