4 Replies Latest reply on Mar 15, 2019 12:49 PM by mirco73

    Hana as Datasource

    mirco73

      Hi,

      some time ago we deployed a VDB reading in SAP ECC system (Teiid 9.3.3) . Now we're going to upgrade SAP ECC to Hana and are looking for changing the Teiid Datasources in order to point to Hana instead of Microsoft SQL Server.

      We're using ngdbc.jar Jdbc drivers and we created a module and Datasources  in the following way:

       

      module.xml:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <module xmlns="urn:jboss:module:1.0" name="com.sap.db">

        <resources>

          <resource-root path="ngdbc.jar"/>

        </resources>

        <dependencies>

          <module name="javax.api"/>

        </dependencies> 

      </module>

       

      driver in domain.xml

       

      <driver name="JdbcHana" module="com.sap.db">

           <driver-class>com.sap.db.jdbc.Driver</driver-class>

      </driver>

       

      datasource in domain.xml

      <datasource jta="false" jndi-name="java:/CAP" pool-name="CAP" enabled="true" use-ccm="true">

            <connection-url>jdbc:sap://xxx.xxx.xxx.xxx:30013/?databaseName=HAT</connection-url>

                 <driver-class>com.sap.db.jdbc.Driver</driver-class>

                      <driver>JdbcHana</driver>

                            <security>

                                <user-name>XXXXXXXX</user-name>

                                 <password>XXXXXXXX</password>

                            </security>

      </datasource>

       

      Although I can see the  com/sap/db/jdbcext/XAExceptionSAP class in the ngdbc.jar fiel, when trying to read any table from the Vdb we get the following error:

       

      2019-03-08 16:35:15,558 WARN  [org.teiid.CONNECTOR] (Worker4_QueryProcessorQueue22) Connector worker process failed for atomic-request=ZTCaetD9G+nm.6.1.0: org.teiid.translator.TranslatorException: TEIID11009 java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/CAP

      at org.teiid.translator.jdbc.JDBCExecutionFactory.getConnection(JDBCExecutionFactory.java:282)

      at org.teiid.translator.jdbc.JDBCExecutionFactory.getConnection(JDBCExecutionFactory.java:69)

      at org.teiid.translator.ExecutionFactory.getConnection(ExecutionFactory.java:205)

      at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:329)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:497)

      at org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:220)

      at com.sun.proxy.$Proxy43.execute(Unknown Source)

      at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:306)

      at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:112)

      at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:108)

      at java.util.concurrent.FutureTask.run(FutureTask.java:266)

      at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:65)

      at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:284)

      at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119)

      at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210)

      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

      at java.lang.Thread.run(Thread.java:745)

      Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/CAP

      at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:146)

      at org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:66)

      at org.teiid.translator.jdbc.JDBCExecutionFactory.getConnection(JDBCExecutionFactory.java:278)

      ... 20 more

      Caused by: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/CAP

      at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:656)

      at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:563)

      at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:747)

      at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:138)

      ... 22 more

      Caused by: javax.resource.ResourceException: IJ031084: Unable to create connection

      at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:343)

      at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:350)

      at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:285)

      at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.createConnectionEventListener(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1319)

      at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.getConnection(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:496)

      at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:626)

      at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:598)

      at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:590)

      ... 25 more

      Caused by: java.lang.NoClassDefFoundError: Failed to link com/sap/db/jdbcext/XAExceptionSAP (Module "com.sap.db:main" from local module loader @9f0666 (finder: local module finder @1c6a36e (roots: c:\teiid-9.3.3\modules,c:\teiid-9.3.3\modules\system\layers\dv,c:\teiid-9.3.3\modules\system\layers\base))): javax/transaction/xa/XAException

      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

      at java.lang.reflect.Constructor.newInstance(Constructor.java:422)

      at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)

      at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)

      at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)

      at org.jboss.modules.Module.loadModuleClass(Module.java:605)

      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)

      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)

      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)

      at com.sap.db.jdbc.DriverSapDB._connect(DriverSapDB.java:1471)

      at com.sap.db.jdbc.DriverSapDB.connect(DriverSapDB.java:1176)

      at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:319)

      ... 32 more

       

       

      2019-03-08 16:35:15,597 WARN  [org.teiid.PROCESSOR] (Worker2_QueryProcessorQueue23) TEIID30020 Processing exception for request ZTCaetD9G+nm.6 'TEIID30504 CAP: TEIID11009 java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/CAP'. Originally TeiidProcessingException 'Failed to link com/sap/db/jdbcext/XAExceptionSAP (Module "com.sap.db:main" from local module loader @9f0666 (finder: local module finder @1c6a36e (roots: c:\teiid-9.3.3\modules,c:\teiid-9.3.3\modules\system\layers\dv,c:\teiid-9.3.3\modules\system\layers\base))): javax/transaction/xa/XAException' sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method). Enable more detailed logging to see the entire stacktrace.

       

      Thanks,

      Mirco

        • 1. Re: Hana as Datasource
          rareddy

          Looks like not all the jar required for the driver in the module you defined.

           

          Caused by: java.lang.NoClassDefFoundError: Failed to link com/sap/db/jdbcext/XAExceptionSAP (Module "com.sap.db:main" from local module loader @9f0666 (finder: local module finder @1c6a36e (roots: c:\teiid-9.3.3\modules,c:\teiid-9.3.3\modules\system\layers\dv,c:\teiid-9.3.3\modules\system\layers\base))): javax/transaction/xa/XAException

           

          Find out all the jars required, copy into that module directory and edit the module.xml to add entries, then restart the server and retry.

           

          Ramesh..

          • 2. Re: Hana as Datasource
            mirco73

            Ha Ramesh,

            actually the class com/sap/db/jdbcext/XAExceptionSAP is included in the jar

            Attached is the jar file present in the module

            • 3. Re: Hana as Datasource
              rareddy

              It does not have to be that exact class, it could any class that is dependent upon. Make sure all the dependencies are included. Consult SAP documentation perhaps to see all the jars involved.

              • 4. Re: Hana as Datasource
                mirco73

                I succeeded in making it work, but it was not a problem of a missing SAP jar, the ngdbc.jar was the only needed.

                I had to add the javax.transaction.api dependency in the module.xml file

                 

                <?xml version="1.0" encoding="UTF-8"?>

                <module xmlns="urn:jboss:module:1.0" name="com.sap.db">

                  <resources>

                    <resource-root path="ngdbc.jar"/>

                  </resources>

                  <dependencies>

                     <module name="javax.api"/>

                     <module name="javax.transaction.api"/>

                  </dependencies> 

                </module>