3 Replies Latest reply on Mar 9, 2010 8:14 PM by Ramesh Reddy

    Teiid VDB as datasource in Grails

    Ahmed Elmeswari Newbie

      Hello,

       

      I have a Grails application which I am trying to use a vdb as the datasource.  I have a junit test that passes using this vdb.  When I set the datasource in Config.groovy to use the vdb as follows:

       

           driverClassName = "org.teiid.jdbc.TeiidDriver"

           url = "jdbc:teiid:DAL@/opt/teiid-6.2.0/deploy.properties"

           username = "admin"

           password = "teiid"

       

      I receive the following exception:

       

      Running Grails application..

      log4j:ERROR Could not parse url [mmfile:/opt/teiid-6.2.0/deploy/log4j.xml].

      java.net.MalformedURLException: unknown protocol: mmfile

      at java.net.URL.<init>(URL.java:574)

      at java.net.URL.<init>(URL.java:464)

      at java.net.URL.<init>(URL.java:413)

      at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)

      at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)

      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

      at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)

      at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)

      at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180)

      at org.apache.log4j.xml.DOMConfigurator$2.parse(DOMConfigurator.java:612)

      at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:711)

      at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:618)

      at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:470)

      at org.apache.log4j.LogManager.<clinit>(LogManager.java:122)

      at org.apache.log4j.Logger.getLogger(Logger.java:104)

      at com.metamatrix.jdbc.Log4JUtil.getLogger(Log4JUtil.java:91)

      at com.metamatrix.jdbc.LogConfigurationProvider$Log4JLogConfiguration.isEnabled(LogConfigurationProvider.java:74)

      at com.metamatrix.common.log.LogManager.isMessageToBeRecorded(LogManager.java:358)

      at com.metamatrix.common.log.LogManager.logMessage(LogManager.java:364)

      at com.metamatrix.common.log.LogManager.logInfo(LogManager.java:214)

      at com.metamatrix.dqp.embedded.DQPEmbeddedPlugin.logInfo(DQPEmbeddedPlugin.java:71)

      at com.metamatrix.dqp.embedded.services.EmbeddedConfigurationService.initializeService(EmbeddedConfigurationService.java:975)

      at com.metamatrix.dqp.embedded.services.EmbeddedBaseDQPService.initialize(EmbeddedBaseDQPService.java:60)

      at org.teiid.dqp.internal.process.DQPCore.start(DQPCore.java:615)

      .....

        • 1. Re: Teiid VDB as datasource in Grails
          Ramesh Reddy Master

          Ahmed,

           

          We have seen this issue https://jira.jboss.org/jira/browse/TEIID-857, which at time we could not reproduce. However later on we fixed the issue related to this, which was fact that it was hiding the original exception. However, I do not recollect what that exception was.

           

          Do you have the any other Teiid classes in your classpath other than the "teiid-6.2.0-client.jar"?, When using the "file path" profile you do not require any other JAR files other than the client jar. Is there any chance you have "deploy" directory in the classpath? If it is they all need to be removed.

           

          Ramesh..

          • 2. Re: Teiid VDB as datasource in Grails
            Ahmed Elmeswari Newbie

            Ramesh,

             

            There are no other Teiid classes in the classpath and deploy directory is not in the classpath either.  Here is the .classpath file within the application.

             

            <?xml version="1.0" encoding="UTF-8"?>
            <classpath>
                <classpathentry kind="src" path="src/java"/>
                <classpathentry kind="src" path="src/groovy"/>
                <classpathentry kind="src" path="grails-app/conf"/>
                <classpathentry kind="src" path="grails-app/controllers"/>
                <classpathentry kind="src" path="grails-app/domain"/>
                <classpathentry kind="src" path="grails-app/services"/>
                <classpathentry kind="src" path="grails-app/taglib"/>
                <classpathentry kind="src" path="test/integration"/>
                <classpathentry kind="src" path="test/unit"/>
                <classpathentry kind="src" path="test/functional"/>
                <classpathentry kind="src" path="grails-app/resources"/>
                <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
                <classpathentry kind="con" path="com.springsource.sts.grails.core.CLASSPATH_CONTAINER"/>
                <classpathentry kind="src" path="hibernate-1.2.0-grails-app-i18n">
                    <attributes>
                        <attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
                    </attributes>
                </classpathentry>
                <classpathentry kind="src" path="jaxrs-0.4-src-java">
                    <attributes>
                        <attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
                    </attributes>
                </classpathentry>
                <classpathentry kind="src" path="jaxrs-0.4-src-groovy">
                    <attributes>
                        <attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
                    </attributes>
                </classpathentry>
                <classpathentry kind="src" path="tomcat-1.2.0-src-groovy">
                    <attributes>
                        <attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
                    </attributes>
                </classpathentry>
                <classpathentry kind="output" path="web-app/WEB-INF/classes"/>
            </classpath>

            • 3. Re: Teiid VDB as datasource in Grails
              Ramesh Reddy Master

              Is there a another "Log4J" library any where in your classpath? For sake of testing move the "log4j.xml" in the "deploy" directory into your classpath and see if that is any better.

               

              I see that during Log4J initialization it found another copy Log4J JAR in higher classloader, however it did not find the "log4j.xml" file (may be your application level defined logging using the "log4j.properties"). However it found the Teiid's "log4j.xml" file, but this file is behind another class loader that is accessible only to the Teiid's classloader.

               

              Ramesh..