13 Replies Latest reply on May 8, 2009 6:25 PM by Ramesh Reddy

    Problem with getMetaData() when Teiid deployed in JBoss AS

    Ken Johnson Newbie

      When issuing a getMetaData() call against Teiid, an AbstractMethodError exception occurs. Teiid 6.0.0 (latest) is deployed in JBoss AS 4.2.3 using the FilePath mode using EmbeddedDataSource configuration. First is the stack trace. Below that is the relevant portion of the test JSP. Note that the query prior to the getMetaData() call works correctly and returns the expected results so the connection is valid.

      The exception trace:

      14:00:23,601 WARN [TxConnectionManager] Connection error occured: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@1ba0281[state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@1646de5 handles=1 lastUse=1241632565620 permit=true trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@6b0a6a context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@178efd5 xaResource=org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper@c9b2bc txSync=null]
      javax.resource.spi.ResourceAdapterInternalException: Unexpected error
      at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.broadcastConnectionError(BaseWrapperManagedConnection.java:393)
      at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.connectionError(BaseWrapperManagedConnection.java:370)
      at org.jboss.resource.adapter.jdbc.WrappedConnection.checkException(WrappedConnection.java:865)
      at org.jboss.resource.adapter.jdbc.WrappedConnection.getMetaData(WrappedConnection.java:534)
      at org.apache.jsp.JBossTest_jsp._jspService(JBossTest_jsp.java:110)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.AbstractMethodError: com.metamatrix.jdbc.MMConnection.getBaseDriver()Lcom/metamatrix/jdbc/BaseDriver;
      at com.metamatrix.jdbc.MMConnection.getMetaData(MMConnection.java:495)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.metamatrix.jdbc.MMXAConnection$CloseInterceptor.invoke(MMXAConnection.java:70)
      at $Proxy70.getMetaData(Unknown Source)
      at org.jboss.resource.adapter.jdbc.WrappedConnection.getMetaData(WrappedConnection.java:530)
      ... 25 more
      14:00:23,605 ERROR [STDERR] May 6, 2009 2:00:23 PM com.metamatrix.jdbc.MMConnection close
      INFO: Connection successfully closed.

      JSP test snippet:

      <%@ page import="javax.naming.*" %>
      <%@ page import="java.sql.*" %>
      <%@ page import="javax.sql.*" %>

      <%! private String connectionInfo = null; %>
      <%! private Connection con = null; %>
      <%! private Statement stmt = null; %>
      <%! private ResultSet rs = null; %>
      <%

      try {

      InitialContext ctxt = new InitialContext();
      DataSource ds = (DataSource) ctxt.lookup("java:/TEIID-XA-DS-Financials");

      con = ds.getConnection();
      // Get a statement from the connection
      stmt = con.createStatement() ;

      // Execute the query
      rs = stmt.executeQuery( "select ProductID, ProductName, ProductType, Issuer, Exchange, DJIComponent, SP500Component, Nas100Component, AmexIntComponent, PrimaryBusiness, SymbolType, Symbol, CUSIP, value from Data_Federation_VML.All_Products_with_values" ) ;

      ResultSetMetaData rsmd = rs.getMetaData();
      int numberOfColumns = rsmd.getColumnCount();

      // Loop through the result set
      while( rs.next() ) {
      for (int i=1; i<=numberOfColumns;i++) {
      System.out.print( rs.getString(i) ) ;
      System.out.print( "\t" ) ;
      }
      System.out.println( "\n" ) ;
      }

      // Close the result set, statement
      rs.close() ;
      stmt.close() ;

      DatabaseMetaData metaData = con.getMetaData();
      connectionInfo = "Database Name: " + metaData.getDatabaseProductName() + "" +
      "Database Version: " + metaData.getDatabaseProductVersion() + "" +
      "Driver Name: " + metaData.getDriverName() + "" +
      "Driver Version: " + metaData.getDriverVersion() + "" +
      "URL: " + metaData.getURL();

      // Close connection
      con.close() ;


      %>

        • 1. Re: Problem with getMetaData() when Teiid deployed in JBoss
          Ramesh Reddy Master

          Is JBoss AS running with Java 1.6? Looks like a version issue of the BaseDriver class. This client is compiled against JDK 1.6. We will have JDK 1.5 supported Embedded JDBC client jar in the 6.1.0 release.

          • 2. Re: Problem with getMetaData() when Teiid deployed in JBoss
            Ken Johnson Newbie

            Yes JBoss AS is running with Sun JDK 1.6.0:

            14:55:07,539 INFO [Server] Starting JBoss (MX MicroKernel)...
            14:55:07,540 INFO [Server] Release ID: JBoss [Trinity] 4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)
            14:55:07,541 INFO [Server] Home Dir: /dev/jboss-4.2.3.GA
            14:55:07,541 INFO [Server] Home URL: file:/dev/jboss-4.2.3.GA/
            14:55:07,542 INFO [Server] Patch URL: null
            14:55:07,542 INFO [Server] Server Name: default
            14:55:07,542 INFO [Server] Server Home Dir: /dev/jboss-4.2.3.GA/server/default
            14:55:07,542 INFO [Server] Server Home URL: file:/dev/jboss-4.2.3.GA/server/default/
            14:55:07,542 INFO [Server] Server Log Dir: /dev/jboss-4.2.3.GA/server/default/log
            14:55:07,543 INFO [Server] Server Temp Dir: /dev/jboss-4.2.3.GA/server/default/tmp
            14:55:07,543 INFO [Server] Root Deployment Filename: jboss-service.xml
            14:55:07,858 INFO [ServerInfo] Java version: 1.6.0_07,Sun Microsystems Inc.
            14:55:07,858 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 10.0-b23,Sun Microsystems Inc.
            14:55:07,858 INFO [ServerInfo] OS-System: Linux 2.6.18-92.1.13.el5,i386
            14:55:08,323 INFO [Server] Core system initialized

            .

            • 3. Re: Problem with getMetaData() when Teiid deployed in JBoss
              Steven Hawkins Master

              This is not reproducible out of the container. Do you get same problem if you try using the EmbeddedDriver rather than the datasource?

              • 4. Re: Problem with getMetaData() when Teiid deployed in JBoss
                Ramesh Reddy Master

                Ken,

                I found that previous instructions for deploying into JBoss AS were misleading, as they were not updated after the 6.0.0 release. I have corrected them at

                http://www.jboss.org/community/docs/DOC-13183

                can you retry on a fresh install of the JBoss AS 4.2.2 and see if you still have an issue. Note that you are not required to copy all the files in the "lib" directory into the JBoss AS "lib" directory.

                • 5. Re: Problem with getMetaData() when Teiid deployed in JBoss
                  Ramesh Reddy Master

                  I tried with fresh install of JBoss 4.2.2 GA, that worked for me. I created "teiid-ds.xml" with the following contents

                  <?xml version="1.0" encoding="UTF-8"?>
                  <datasources>
                   <local-tx-datasource>
                   <jndi-name>TEIID-DS</jndi-name>
                   <connection-url>jdbc:metamatrix:pp@/home/rareddy/teiid/teiid-embedded-6.0.0/deploy.properties;dqp.useNonDelegateClassloader=true</connection-url>
                   <driver-class>com.metamatrix.jdbc.EmbeddedDriver</driver-class>
                   <min-pool-size>5</min-pool-size>
                   <max-pool-size>10</max-pool-size>
                   </local-tx-datasource>
                  </datasources>
                  


                  where "pp" in the URL was the my VDB name. I would think the using DataSource would work too.

                  • 6. Re: Problem with getMetaData() when Teiid deployed in JBoss
                    Ken Johnson Newbie

                    I'll try these suggestions today:
                    - using embeddeddriver vs embeddeddatasource
                    - reconfiguring JBoss AS with the new instructions

                    FWIW, my datasource config file uses the xa-datasource not the local-tx-datasource:

                    <?xml version="1.0" encoding="UTF-8"?>
                     <datasources>
                     <xa-datasource>
                     <jndi-name>TEIID-XA-DS-Financials</jndi-name>
                     <xa-datasource-class>com.metamatrix.jdbc.EmbeddedDataSource</xa-datasource-class>
                     <xa-datasource-property name="DatabaseName">FinancialsVDB</xa-datasource-property>
                     <xa-datasource-property name="BootstrapFile">/home/kejohnso/NotBackedUp/dev/teiid-embedded-6.0.0/deploy.properties</xa-datasource-property>
                     </xa-datasource>
                     </datasources>


                    • 7. Re: Problem with getMetaData() when Teiid deployed in JBoss
                      Ramesh Reddy Master

                      Actually, there was one issue I saw

                      https://jira.jboss.org/jira/browse/TEIID-472

                      However, there is workaround for this for now. Look on the defect for the workaround details. Also, note in the root of <embedded-install-dir> there is client patch jar, that needs to be copied over to the JBoss "lib" directory too.[/url]

                      • 8. Re: Problem with getMetaData() when Teiid deployed in JBoss
                        Ramesh Reddy Master

                        I just verified the successful connection and "select" query using the "EmbeddedDataSource", I used the following "teiid-xa-ds.xml" inside the jboss deploy directory

                        <?xml version="1.0" encoding="UTF-8"?>
                        <datasources>
                         <xa-datasource>
                         <jndi-name>TEIID-XADS</jndi-name>
                         <xa-datasource-class>com.metamatrix.jdbc.EmbeddedDataSource</xa-datasource-class>
                         <xa-datasource-property name="DatabaseName">pp</xa-datasource-property>
                         <xa-datasource-property name="BootstrapFile">/home/rareddy/teiid/teiid-embedded-6.0.0/deploy.properties</xa-datasource-property>
                         <xa-datasource-property name="AdditionalProperties">dqp.useNonDelegateClassloader=true</xa-datasource-property>
                         </xa-datasource>
                        </datasources>
                        



                        There is one issue that logged, if you are planning to use XA with SQL Server

                        https://jira.jboss.org/jira/browse/TEIID-559

                        • 9. Re: Problem with getMetaData() when Teiid deployed in JBoss
                          Ken Johnson Newbie

                          Thanks Ramesh. I do have the client patch jar from Teiid-embedded root copied to my default/lib directory on JB AS.

                          Also, regarding the xa-datasource, I'm also having success with select. I can get data out. However, it's this configuration in which the getMetaData() call fails with the exception above. Using the data source definition from your last post, can you successfully issue getMetaData() on the connection?

                          • 10. Re: Problem with getMetaData() when Teiid deployed in JBoss
                            Ramesh Reddy Master

                            Yes, I reproduced the exception you are seeing. I logged as

                            https://jira.jboss.org/jira/browse/TEIID-564

                            Looks like some issue with connection wrapping in the JBoss, we will investigate.

                            Thanks.

                            • 11. Re: Problem with getMetaData() when Teiid deployed in JBoss
                              Ramesh Reddy Master

                              This issue is happening because, the abstract class and concrete class were in different class loaders, at that time package private systematics do not seem work correctly. For correcting this making all abstract methods on MMConnection to "public" visibility.

                              One another thing noticed is in JBoss AS deploying the fix as the "patch" jar file did not work. It only worked once the patch is combined with original client jar into single jar file.

                              • 12. Re: Problem with getMetaData() when Teiid deployed in JBoss
                                Ken Johnson Newbie

                                Tried the new config instructions in
                                http://www.jboss.org/community/docs/DOC-13183.
                                but having new problem.

                                1. I reverted to a clean install of AS 4.2.3.
                                2. Copied Teiid client JAR to default/lib directory (I had previously merged the client patch classes into the client jar rather than deploying the patch jar separately based on comments in JIRA TEIID-564)
                                3. Changed DS file to include the line:
                                <xa-datasource-property name="AdditionalProperties">dqp.useNonDelegateClassloader=true</xa-datasource-property>

                                Appserver starts cleanly but upon obtaining a connection, runs into exceptions that appear largely to do with using the non delegating classloader.

                                16:09:32,250 ERROR [STDERR] log4j:ERROR A "org.jboss.logging.appender.FileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
                                16:09:32,250 ERROR [STDERR] log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
                                16:09:32,250 ERROR [STDERR] log4j:ERROR [com.metamatrix.common.classloader.NonDelegatingClassLoader@10f3bd7] whereas object of type
                                16:09:32,251 ERROR [STDERR] log4j:ERROR "org.jboss.logging.appender.FileAppender" was loaded by [org.jboss.system.server.NoAnnotationURLClassLoader@b66cc].
                                16:09:32,251 ERROR [STDERR] log4j:ERROR Could not instantiate appender named "FILE".
                                16:09:32,299 WARN [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
                                org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.lang.reflect.UndeclaredThrowableException)
                                at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:155)
                                at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:619)
                                at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:264)
                                at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:575)
                                at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:347)
                                at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:330)
                                at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:402)
                                at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:849)
                                at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
                                at org.apache.jsp.JBossTest_jsp._jspService(JBossTest_jsp.java:87)
                                at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
                                at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                                at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
                                at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
                                at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
                                at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                                at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                                at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
                                at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                                at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                                at java.lang.Thread.run(Thread.java:619)
                                Caused by: java.lang.reflect.UndeclaredThrowableException
                                at org.jboss.resource.JBossResourceException.process(JBossResourceException.java:204)
                                at org.jboss.resource.JBossResourceException.(JBossResourceException.java:111)
                                ... 34 more
                                Caused by: java.lang.NoClassDefFoundError: javax/transaction/TransactionSynchronizationRegistry
                                at java.lang.ClassLoader.defineClass1(Native Method)
                                at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
                                at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
                                at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
                                at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
                                at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
                                at java.security.AccessController.doPrivileged(Native Method)
                                at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
                                at com.metamatrix.common.classloader.NonDelegatingClassLoader.loadClass(NonDelegatingClassLoader.java:73)
                                at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
                                at com.metamatrix.xa.arjuna.ArjunaTransactionProvider.init(ArjunaTransactionProvider.java:104)
                                at com.metamatrix.xa.arjuna.ArjunaTransactionProvider.getInstance(ArjunaTransactionProvider.java:79)
                                at com.metamatrix.dqp.embedded.services.EmbeddedTransactionService.initializeService(EmbeddedTransactionService.java:58)
                                at com.metamatrix.dqp.embedded.services.EmbeddedBaseDQPService.initialize(EmbeddedBaseDQPService.java:59)
                                at com.metamatrix.common.application.Application.start(Application.java:62)
                                at org.teiid.dqp.internal.process.DQPCore.start(DQPCore.java:563)
                                at com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl.initialize(EmbeddedConnectionFactoryImpl.java:113)
                                at com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl.createConnection(EmbeddedConnectionFactoryImpl.java:79)
                                at com.metamatrix.jdbc.EmbeddedDriver$EmbeddedTransport.createConnection(EmbeddedDriver.java:502)
                                at com.metamatrix.jdbc.EmbeddedDriver.createConnection(EmbeddedDriver.java:134)
                                at com.metamatrix.jdbc.EmbeddedDataSource.getConnection(EmbeddedDataSource.java:160)
                                at com.metamatrix.jdbc.BaseDataSource$1.createConnection(BaseDataSource.java:454)
                                at com.metamatrix.jdbc.MMXAConnection.getMMConnection(MMXAConnection.java:108)
                                at com.metamatrix.jdbc.MMXAConnection.getConnection(MMXAConnection.java:94)
                                at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.(XAManagedConnection.java:57)
                                at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.newXAManagedConnection(XAManagedConnectionFactory.java:165)
                                at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:141)
                                ... 33 more
                                Caused by: java.lang.ClassNotFoundException: javax.transaction.TransactionSynchronizationRegistry
                                at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
                                at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
                                at com.metamatrix.common.classloader.NonDelegatingClassLoader.loadClass(NonDelegatingClassLoader.java:88)
                                at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
                                ... 60 more

                                • 13. Re: Problem with getMetaData() when Teiid deployed in JBoss
                                  Ramesh Reddy Master

                                  Looks like your copy of Teiid Embedded's installation is missing jar. I know application servers does provide "jta.jar". But seems to be Jboss provided one does not contain same classes as Teiid Embedded's. Try putting the jta.jar back and see if that works.