Deploying Teiid Embedded in JBossAS

This article shows how to deploy a Teiid Embedded and a VDB into JBossAS using the "File Path" profile. Using below instructions you should be able to deploy Teiid Embedded and configure the VDB as any other JDBC datasource, which can used in your web application. Before you proceed, have the VDB and any dependent JAR files needed by Connectors readily available.

 

Note that you can also use the "classpath" profile, however since we use some common libraries between the JBoss AS and Teiid, this may have some class version incompatibilities with different versions. so, we always recommend using File Path profile with JBossAS.

 

Steps to Deploy:

 

  1. Download the Teiid Embedded kit, and unzip it to known location accessible to your JBossAS instance.
  2. Copy the "teiid-${version}-client.jar" file in inside "<embedded-kit-install>" into "<jboss-install>/server/default/lib" directory.
  3. If your Virtual Database (VDB) is using any native sources like Oracle, MySQL, then copy the JDBC Driver or DataSource JAR files for these RDMS vendors  in the "<embedded-kit-install>/extensions" directory. This also applies to any dependent JAR files that may be needed by the connectors you are using with your VDB. Note: These files should be the same JAR files you may have used to import metadata in Teiid Designer. If you are using different JAR files than you used inside the Desinger, then the names of the JAR files need to be modified in "ConfigurationInfo.def" file which is inside VDB artifact. You can use zip utility to open the VDB file and edit this file.
  4. Copy your VDB file to "<embedded-kit-install>/deploy" directory.
  5. Create a "teiid-ds.xml" file in "<jboss-install>/server/default/deploy" directory.  Note: the use the local-tx-datasource is recommended for 6.0 Teiid Embedded, see below. The contents of the file should look like       

  <?xml version="1.0" encoding="UTF-8"?>
  <datasources>
  <xa-datasource>
    <jndi-name>TEIID-DS</jndi-name>
    <xa-datasource-class>com.metamatrix.jdbc.EmbeddedDataSource</xa-datasource-class>
    <xa-datasource-property name="DatabaseName"><your-vdb-name></xa-datasource-property>
    <xa-datasource-property name="BootstrapFile"><embedded-kit-install>/deploy.properties</xa-datasource-property>
    <track-connection-by-tx>true</track-connection-by-tx>
    <isSameRM-override-value>false</isSameRM-override-value>
    <no-tx-separate-pools />

    <!-- pool and other JBoss datasource properties -->
    <min-pool-size>5</min-pool-size>
    <max-pool-size>10</max-pool-size>
               
  </xa-datasource>       
  </datasources> 
       
      

Now, restart the JBoss application server and use it as any other JDBC data source inside your application using the given JNDI name.

 

If you would like to use the "com.metamatrix.jdbc.EmbeddedDriver" instead of the data source class, you can the below XML file to define the data source.

         

          <?xml version="1.0" encoding="UTF-8"?>
          <datasources>
            <local-tx-datasource>
              <jndi-name>TEIID-DS</jndi-name>
              <connection-url>jdbc:metamatrix:<your-vdb-name>@<embedded-kit-install>/deploy.properties</connection-url>
              <driver-class>com.metamatrix.jdbc.EmbeddedDriver</driver-class>
             

<!-- uncomment for Teiid 6.0
              <connection-property name="
dqp.useNonDelegateClassloader">true</connection-property>
              <connection-property name="metamatrix.xatxnmgr.enabled">false</connection-property>
-->

              <!-- pool and other JBoss datasource properties -->
              <min-pool-size>5</min-pool-size>
              <max-pool-size>10</max-pool-size>
             
            </local-tx-datasource>
          </datasources>

      

Teiid 6.0 Specific Instructions

 

The Teiid Embedded kit has all the required file that are needed by a Java application to embed Teiid runtime engine, however in certain deployments like in any Application Servers like JBoss AS, you do not need

 

1) jta-1.1.jar

2) servlet-api-2.3.jar

3) connector-api-1.5.jar

 

so, you can delete these files as they are provided by the Application Server. Also note on the URL of the connection string, the property "dqp.useNonDelegateClassloader=true", this will load all the Teiid Embedded classes using post-delegation class loader that will avoid any conflicts within the JBoss AS. "metamatrix.xatxnmgr.enabled=false" will not load transaction engine, which causing the clashes in class with JBoss transactions. These settings and jar removals are not required in Teiid 6.1.0.