8 Replies Latest reply on Oct 4, 2012 11:12 PM by David Eichmann

    Teiid 8.1 - dynamic VDB, UDF class not found

    David Eichmann Newbie

      I'm attempting to deploy a UDF in a dynamic VDB and getting a ClassNotFound:

       

      14:45:41,654 ERROR [org.jboss.threads.executor] (teiid-async-threads - 4) Task execution failed for task org.teiid.jboss.VDBService$6@3327d4d9: org.teiid.core.TeiidRuntimeException: TEIID30387 Could not load UDF "institute", since its invocation class "edu.uiowa.tagUtil.grantParser.nih" could not be found.

          at org.teiid.query.function.FunctionTree.createFunctionDescriptor(FunctionTree.java:321) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]

          at org.teiid.query.function.FunctionTree.addFunction(FunctionTree.java:232) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]

          at org.teiid.query.function.FunctionTree.<init>(FunctionTree.java:106) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]

          at org.teiid.deployers.CompositeVDB.buildTransformationMetaData(CompositeVDB.java:84) [teiid-runtime-8.1.0.Final.jar:8.1.0.Final]

          at org.teiid.deployers.CompositeVDB.metadataLoadFinished(CompositeVDB.java:333) [teiid-runtime-8.1.0.Final.jar:8.1.0.Final]

          at org.teiid.deployers.VDBRepository.finishDeployment(VDBRepository.java:287) [teiid-runtime-8.1.0.Final.jar:8.1.0.Final]

          at org.teiid.runtime.AbstractVDBDeployer.metadataLoaded(AbstractVDBDeployer.java:166) [teiid-runtime-8.1.0.Final.jar:8.1.0.Final]

          at org.teiid.jboss.VDBService.access$800(VDBService.java:89) [teiid-jboss-integration-8.1.0.Final.jar:8.1.0.Final]

          at org.teiid.jboss.VDBService$6.run(VDBService.java:385) [teiid-jboss-integration-8.1.0.Final.jar:8.1.0.Final]

          at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)

          at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:801)

          at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)

          at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:842)

          at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_35]

          at org.jboss.threads.JBossThread.run(JBossThread.java:122)

      Caused by: java.lang.ClassNotFoundException: edu.uiowa.tagUtil.grantParser.nih from [Module "org.jboss.teiid:main" from local module loader @671ff436 (roots: /Users/eichmann/downloads/jboss/jboss-as-7.1.1.Final/modules)]

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]

          at java.lang.Class.forName0(Native Method) [classes.jar:1.6.0_35]

          at java.lang.Class.forName(Class.java:247) [classes.jar:1.6.0_35]

          at org.teiid.query.function.UDFSource.getInvocationClass(UDFSource.java:44) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]

          at org.teiid.query.function.FunctionTree.createFunctionDescriptor(FunctionTree.java:311) [teiid-engine-8.1.0.Final.jar:8.1.0.Final]

          ... 14 more

       

      I've created the following module.xml in <teiid>/modules/edu/uiowa/main:

       

       

      {code:xml}<?xml version="1.0" encoding="UTF-8"?>

      <module xmlns="urn:jboss:module:1.0" name="edu.uiowa">

        <resources>

          <resource-root path="UtilTagLib-0.0.3-SNAPSHOT.jar"/>

        </resources>

        <dependencies>

          <module name="javax.api"/>

        </dependencies>

      </module>

      {code}

       

      and the vdb looks like this:

       

      {code:xml}<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

      <vdb name="warehouse" version="1">

       

          <description>Warehouse VDB</description>

       

          <property name="UseConnectorMetadata" value="true" />

          <property name ="lib" value ="edu.uiowa" />

       

              <model name="dsp" visible="true" >

                      <property name="importer.tableTypes" value="TABLE,VIEW" />

                      <property name="importer.useFullSchemaName" value="false" />

                      <property name="importer.importKeys" value="true" />

                      <property name="importer.importIndexes" value="true" />

                      <property name="importer.importApproximateIndexes" value="true" />

                      <property name="importer.schemaPattern" value="dbo" />

                      <source name="dsp-connector" translator-name="sqlserver" connection-jndi-name="java:dsp-ds" />

                  <metadata type="DDL"><![CDATA[

                      CREATE VIRTUAL FUNCTION institute(grantString varchar) RETURNS varchar OPTIONS (JAVA_CLASS 'edu.uiowa.tagUtil.grantParser.nih',  JAVA_METHOD 'institute');

                      CREATE VIRTUAL FUNCTION serial_number(grantString string) RETURNS integer OPTIONS (JAVA_CLASS 'edu.uiowa.tagUtil.grantParser.nih',  JAVA_METHOD 'serialNumber');

                  ]]> </metadata>

              </model>

      {code}

      ...

       

      The jar's definitely got the class in it, which looks in part like this:

       

       

      {code}package edu.uiowa.tagUtil.grantParser;

       

      import java.util.regex.Matcher;

      import java.util.regex.Pattern;

       

      public class nih {

       

          private static Pattern awardPattern = Pattern.compile("([1-9]?)[\\- ]*([A-Z][0-9][0-9])?[\\- ]*([A-Z][A-Z])[\\- ]*([0-9]+)[\\- ]*([0-9]*)[\\- ]*([A][0-9])?[\\- ]*([S][0-9])?");

       

          private static String match(String source, int position) {

              Matcher theMatcher = awardPattern.matcher(source);

              if (theMatcher.matches())

                  return theMatcher.group(position);

              else

                  return null;

          }

       

          public static String institute(String grant) {

              return match(grant, 3);

         }

      {code}

       

       

       

       

      I've tried placing the jar next to the module.xml, and in the standalone/deployments, standalone/lib, and standalone/lib/ext directories with no success.  Just where does the class loader go looking in this case?