Testonborrow Tomcat

AttributeDetails
auth(String) Specify whether the web Application code signs on to the corresponding resource manager programmatically, or whether the Container will sign on to the resource manager on behalf of the application. The value of this attribute must be Application or Container. This attribute is required if the web application will use a resource-ref element in the web application deployment descriptor, but is optional if the application uses a resource-env-ref instead.
driverClassName(String) The fully qualified Java class name of the JDBC driver to be used. The driver has to be accessible from the same classloader as the database connection pool jar.
factory(String) Full class path to the connection datasource factory.
initialSize(int)The initial number of connections that are created when the pool is started. Default value is 10
maxIdle(int) The minimum number of established connections that should be kept in the pool at all times. The connection pool can shrink below this number if validation queries fail. Default value is derived from initialSize of 10
maxTotal / maxActive(int) The maximum number of active connections that can be allocated from this pool at the same time. The default value is 100. Note that this attribute name differs between pool implementations and documentation is often incorrect.
maxWaitMillis / maxWait(int) The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception. Default value is 30000 (30 seconds). Note that this attribute name differs between pool implementations and documentation is often incorrect.
name(String) Name used to bind to JNDI context.
password(String) DB connection password.
url(String) (String) JDBC connection URL.
username(String) DB connection username.
testOnBorrow(boolean) The indication of whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another. NOTE - for a true value to have any effect, the validationQuery or validatorClassName parameter must be set to a non-null string. In order to have a more efficient validation, see validationInterval. Default value is false.
validationQuery(String) The SQL query that will be used to validate connections from this pool before returning them to the caller. If specified, this query does not have to return any data, it just can't throw a SQLException. The default value is null. Example values are SELECT 1(mysql), select 1 from dual(oracle), SELECT 1(MS Sql Server)

Tomcat Testonborrow 設定

Procedure

Management Console and Kapplets can be installed in the same Tomcat or in different environments. (e.g. : MC and Kapplets both deployed in Tomcat but in two different Tomcat services on the same machine or different machines. Or Management Console in embedded mode and Kapplets deployed into Tomcat).

Tomcat

Testonborrow Tomcat9

To see the similar article for deploying Management Console in standalone Tomcat, see Knowledgebase article #12398.

Apache tomcat testonborrow

TestOnBorrow: true: The indication of whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another. TestOnReturn: false: The indication of whether objects will be validated before being returned to the pool. TestOnBorrow = true – by setting this, the objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another. NOTE – for a true value to have any effect, the validationQuery parameter must be set to a non-null string.

Is the SQLRecoverableException, expected here. Do I need to restart tomcat, to establish a successfull connection back to database? In a typical production environments, if DB is shutdown for any reason and was brought back, should the application servers also need to be restarted. I think, it is not required. TestOnBorrow If true connections will be validated before being returned from the pool. If the validation fails, the connection is destroyed, and a new conection will be retrieved from the pool (and validated). NOTE - for a true value to have any effect, the ValidationQuery parameter must be set.

Testonborrow TomcatTomcat
  1. Prerequisites:
    • Java installed download - at least jre (e.g. from oracle.com)
    • Tomcat Windows Service installer download (from the Apache downloads page)
    • If deploying Kapplets - Database for the Kapplets tables. Tomcat will need to be able to create tables in this database.
      If the user provided for it doesn't have rights to create tables, a DBA will have to create them in advance.
      The scripts to create tables are in the Kofax RPA (Kapow) installation folder under the documentation -> sql folder. The tables from the following folders should be created:
      • kapplets

If the user has rights to create tables, an empty database is enough.

If deploying Management Console and Kapplets in Tomcat (either same service or difference service) Management Console and Kapplets each need a database. You cannot use the same database for both applications.

  • JDBC driver for the database type.

    Check the version of

    • Java
    • Tomcat
    • Database
    • Operating System

    currently supported by Kofax RPA (Kapow) in the Technical Specifications file (from the User Guides section).

  1. Java Configuration
    • Install Java.
    • Configure JRE_HOME using the Environment Variables window or by using the set command
      E.g.
      set JRE_HOME=C:Program FilesJavajre1.8.0_101
  2. Tomcat basic configuration
    • Install Tomcat and follow the prompts.
    • If needed, change the tomcat ports in server.xml
    • If needed, start the 'Configure Tomcat' application and change the memory settings for Java.
    • Start the Tomcat service to verify that Tomcat can be reached (by default Tomcat's url is http://localhost:8080)

      Steps from sections 2 and 3 are the general steps to install and configure Tomcat. For more specific details, please consult the Apache documentation.

  3. Deployment of Kapplets - expand war file
    • Stop the Tomcat service if it's running
    • Copy the kapplets.war file from <Kofax RPA installation folder>WebApps to <Tomcat installation folder>webapps
      E.g. from C:Program FilesKofax RPA 11.0.0.0 173 x64WebApps to C:Program FilesApache Software FoundationTomcat 8.5_Tomcat8_kappletswebapps
    • Start the Tomcat service
      Tomcat will expand the .war file but it won't be able to use it (configuration will be done in the next section) so ignore all errors from log and allow Tomcat at least 5 minutes to complete the task. In the end, the webapps folder under Tomcat will have a kapplets folder with content similar to:
  4. Deployment of Kapplets - configuration
    • Stop the Tomcat service
    • Copy the JDBC .jar driver file into <Tomcat installation folder>lib
    • Create the kapplets.xml context file in <Tomcat installation folder>confCatalinalocalhost with this content

      'kapplets' is case sensitive. the XML file name has to match the .war file name and application name from under the webapps folder.

      <Context useHttpOnly='true'>

      <!-- Default set of monitored resources -->

      <WatchedResource>WEB-INF/web.xml</WatchedResource>

      <Resource name='jdbc/kapow/kapplets' auth='Container' type='javax.sql.DataSource'

      maxActive='100' maxIdle='30' maxWait='-1'

      username='UserToAccessDB' password='PasswordForPreviousUser'

      driverClassName='Driver Class Name for your Database Type'

      validationQuery='Validation Query for your Database Type' testOnBorrow='true'

      url='URL Connection String for your Database Type'/>
      <Environment name='spring.datasource.jndi-name' value='jdbc/kapow/kapplets' type='java.lang.String' override='false'/>
      <Environment name='spring.jpa.database-platform' value='DB Server Dialect here' type='java.lang.String' override='false'/>
      <Environment name='kapplets.services.mc.connection.url' value='Management Console URL here' type='java.lang.String' override='false'/>
      <Environment name='kapplets.services.mc.connection.username' value='MC User here' type='java.lang.String' override='false'/>
      <Environment name='kapplets.services.mc.connection.password' value='password for MC User' type='java.lang.String' override='false'/>

      </Context>

      See attached a few examples of context file for the Kapplets application that use different database types.

    • Restart the Tomcat service. If all settings are correct, the Kapplets application will reach to the database, create tables in it and start using them.
    • Test kapplets by loading this url (replace hostname and port if needed)
      http://localhost:8080/kapplets

      'kapplets' is case sensitive. Therefore

      • kapplets.war from under the webapps folder
      • kapplets folder from under webapps folder
      • kapplets.xml from under confCatalinalocalhost folder
      • the url http://localhost:8080/kapplets

      have to use the same case!

      A successful deployment means the website is prompting for login (use admin/admin).
      If the website is throwing an error, at least one of the configuration settings is not correct. In this case, check the Tomcat stdout and strerr log files (from <Tomcat installation folder>logs). The most common error is 'Could not connect to the platform database' - see Knowledgebase article 306641.

      More detailed information about the Kapplets deployment can be found in the Installation Guide > Install Kofax RPA > Install on Windows > Install Kapplets