10 Replies Latest reply on Apr 11, 2012 11:35 AM by rokhmanov

    Unable to deploy a custome translator in 8.0 alpha1

    skethire

      I created a custom translator that extends the JDBCTranslator.

      I packaged the classes into a jar, I created a manifest.mf with the dependencies property, I created the META-INF/services/ registry per the documentation. 

      However, when I deploy the jar file, it seems like it is not being deployed. 

      The log shows that it is deployed:

       

           19:25:56,076 INFO [org.jboss.as.server] (management-handler-threads - 7) JBAS018559: Deployed "mytranslator.jar"

       

      But I am unable to access my data.  When I debug, I noticed that TeiidAttachments.isTranslator() is returing false. 

       

      My jar is attached.  What am I missing?

       

      Thanks in advance

      Srini

        • 1. Re: Unable to deploy a custome translator in 8.0 alpha1
          rareddy

          Your manifest.mf has "dependencies" line in two lines, may be that is causing that. With out all dependencies I can not deploy your jar in my system to test.

           

          Otherwise, you can also create the jar into a module and add the translator-name manually to the configuration to load it, as Teiid does for its translators.

           

          Ramesh..

          • 2. Re: Unable to deploy a custome translator in 8.0 alpha1
            skethire

            I fixed the manifest.mf - but I see the same behavior.

            • 3. Re: Unable to deploy a custome translator in 8.0 alpha1
              skethire

              Deploying the same jar as a module and loading it as a translator through the teiid subsystem works fine.

               

              It seems like there is a problem with the translator jar deployment in 8.0.  I haven't tried this in previous releases.

               

              For now, I will use the module approach. 

               

              It would also be nice if we can get some feedback on what went wrong during deployment.  When module configuration is wrong, JBOSS prints out detailed error message.

              In this case I did not get any feedback either during the translator deployment, or during the vdb deployment.  The only way I know the vdb is not up is when I try to connect to it.

               

              Thanks

              srini

              • 4. Re: Unable to deploy a custome translator in 8.0 alpha1
                rareddy

                Srini,

                 

                I do not see anything wrong in the code. If you want attach me a simple translator with source code with no other dependencies other than Teiid, I will try to see what is going on.

                 

                Ramesh..

                • 5. Re: Unable to deploy a custome translator in 8.0 alpha1
                  rokhmanov

                  Is this issue with custom translator deployment resolved in 8.0.0.CR1? From what I see all custom translators are expected to be defined as modules, is this true?

                   

                  Here is my attempt to deploy a custom translator:

                  • I have a SampleJDBCExecutionFactory (with @Translator name=sample-async), which extends the JDBCExecutionFactory and does nothing.
                  • Dependency: org.jboss.teiid.common-core,org.jboss.teiid.api,org.jboss.teiid.translator.jdbc
                  • META-INF/services/org.teiid.translator.ExecutionFactory has com.somepackage.SampleJDBCExecutionFactory #sample-async
                  • The portfolio-vdb.xml from "DynamicPortfolio" example from Teiid modified in a way that "h2-connector" for "Accounts" model has translator-name="sample-async" instead of "h2".

                   

                  My expectation is that after placing the custom translator jar into the deployments folder and start standalone (jboss-as-7.1.1.Final) the deployment will complete. Instead I see that all markers (vdb, custom translator) as failed. This is what I see in server.log (the asyncTest jar is my custom translator):

                   

                  11:56:16,197 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.teiid.vdb.DynamicPortfolio.1: org.jboss.msc.service.StartException in service j

                  boss.teiid.vdb.DynamicPortfolio.1: TEIID50035

                          at org.teiid.jboss.VDBService.createConnectorManagers(VDBService.java:231)

                          at org.teiid.jboss.VDBService.start(VDBService.java:123)

                          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_02]

                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_02]

                          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_02]

                  Caused by: [TeiidException] TEIID50057: Error Code:TEIID50057 Message:TEIID50057 <Missing message for key "TEIID50057" in: org.teiid.runtime.i18n>

                  1 [ModuleNotFoundException]Module asyncTest-3.0.0-SNAPSHOT.jar:main is not found in local module loader @118e0f0f (roots: C:\Users\rokan01\work\jboss7_teiid8\modules)

                          at org.teiid.jboss.VDBService.getExecutionFactory(VDBService.java:261)

                          at org.teiid.jboss.VDBService.createConnectorManagers(VDBService.java:226)

                          ... 6 more

                  Caused by: org.jboss.modules.ModuleNotFoundException: Module asyncTest-3.0.0-SNAPSHOT.jar:main is not found in local module loader @118e0f0f (roots: C:\Users\rokan01\work\jboss7_teiid8\modules

                  )

                          at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:126)

                          at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:275)

                          at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:222)

                          at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:94)

                          at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:204)

                          at org.teiid.jboss.VDBService.getExecutionFactory(VDBService.java:258)

                          ... 7 more

                   

                  Thanks,

                  Andriy

                  • 6. Re: Unable to deploy a custome translator in 8.0 alpha1
                    rareddy

                    Andriy,

                     

                    The issue Srini was having I never could re-produce, so I can not say definitively what is going wrong there. Coming to the issue you are facing, you can deploy a translator two different ways

                     

                    1) Package into a jar, and create module from it, then define the "translator" in the teiid subsystem configuration in the standalone-teiid.xml file. This recommended for stable configurations.

                     

                    2) Package into jar, and use deploy mechnisms to deploy into the JBoss AS. Copying it into the "deployments" directory might also work in standalone but not in the domin mode. This recommended during the development as this gives quick deployment and undeployment. Note that when you do this, there is no need to edit the teiid subsystem to add the translator manually or through CLI. This can be done while server is rnning, no restart required.

                     

                    What is your translator jar file name? I believe it is asyncTest-3.0.0-SNAPSHOT.jar, how did you deploy this? did you see any message on console saying that the translator is deployed?

                     

                    Ramesh..

                    • 7. Re: Unable to deploy a custome translator in 8.0 alpha1
                      rokhmanov

                      Ramesh,

                       

                      My translator works fine when I do a module. I have errors when I follow the steps in your way #2. Here is my steps to reproduce the problem, in more details this time:

                      • Install "dynamicvdb-portfolio" example from docs\teiid\examples\dynamicvdb-portfolio\ (follow the README.txt);
                      • Start JBoss, make sure portfolio-vdb.xml deployed, DynamicPortfolio.1 VDB is active and return data;
                      • Copy custom translator jar to standalone/deployment folder, see "TEIID50006 Teiid translator "sample-async" added" and "JBAS018559: Deployed "asyncTest-3.0.0-SNAPSHOT.jar" in server.log
                      • Modify local copy of portfolio-vdb.xml - replace translator-name="h2" to translator-name="sample-async", overwrite the portfolio-vdb.xml in standalone\deployment;
                      • See the portfolio-vdb.xml.failed marker and the error message in server.log:

                       

                      15:20:07,281 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.teiid.vdb.DynamicPortfolio.1: org.jboss.msc.service.StartException in service jboss.teiid.vdb.DynamicPortfolio.1: TEIID50035

                          at org.teiid.jboss.VDBService.createConnectorManagers(VDBService.java:231)

                          at org.teiid.jboss.VDBService.start(VDBService.java:123)

                          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_02]

                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_02]

                          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_02]

                      Caused by: [TeiidException] TEIID50057: Error Code:TEIID50057 Message:TEIID50057 <Missing message for key "TEIID50057" in: org.teiid.runtime.i18n>

                      1 [ModuleNotFoundException]Module asyncTest-3.0.0-SNAPSHOT.jar:main is not found in local module loader @57eaaca (roots: C:\Users\rokan01\work\jboss7_teiid8\modules)

                          at org.teiid.jboss.VDBService.getExecutionFactory(VDBService.java:261)

                          at org.teiid.jboss.VDBService.createConnectorManagers(VDBService.java:226)

                          ... 6 more

                      Caused by: org.jboss.modules.ModuleNotFoundException: Module asyncTest-3.0.0-SNAPSHOT.jar:main is not found in local module loader @57eaaca (roots: C:\Users\rokan01\work\jboss7_teiid8\modules)

                          at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:126)

                          at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:275)

                          at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:222)

                          at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:94)

                          at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:204)

                          at org.teiid.jboss.VDBService.getExecutionFactory(VDBService.java:258)

                          ... 7 more

                       

                      I cannot attache the custom translator source code in reply message, here is the code inline:

                       

                       

                      file "MANIFEST.MF":

                       

                      Manifest-Version: 1.0

                      Archiver-Version: Plexus Archiver

                      Created-By: Apache Maven

                      Built-By: rokan01

                      Build-Jdk: 1.7.0_02

                      Dependencies: org.jboss.teiid.common-core,org.jboss.teiid.api,org.jbos

                      s.teiid.translator.jdbc

                       

                       

                      file "services/org.teiid.translator.ExecutionFactory":

                      com.ca.chorus.teiid.translator.async.SampleJDBCAsyncExecutionFactory #sample-async

                       

                       

                      file "SampleJDBCAsyncExecutionFactory.java":

                       

                      package com.ca.chorus.teiid.translator.async;

                       

                      import java.sql.Connection;

                       

                      import org.teiid.language.QueryExpression;

                      import org.teiid.metadata.RuntimeMetadata;

                      import org.teiid.translator.ExecutionContext;

                      import org.teiid.translator.ResultSetExecution;

                      import org.teiid.translator.Translator;

                      import org.teiid.translator.TranslatorException;

                      import org.teiid.translator.jdbc.JDBCExecutionFactory;

                       

                      @Translator(name="sample-async")

                      public class SampleJDBCAsyncExecutionFactory extends JDBCExecutionFactory

                      {

                       

                          @Override

                          public ResultSetExecution createResultSetExecution(QueryExpression command,

                                  ExecutionContext executionContext, RuntimeMetadata metadata,

                                  Connection conn) throws TranslatorException

                          {

                              return super.createResultSetExecution(command, executionContext, metadata, conn);

                          }

                       

                      }

                      • 8. Re: Unable to deploy a custome translator in 8.0 alpha1
                        rareddy

                        Andriy,

                         

                        Yes, that is bug. It was deploying the translator,  however it was not able to use in the VDB. Can you open JIRA for this.

                         

                        Thanks

                         

                        Ramesh

                        • 9. Re: Unable to deploy a custome translator in 8.0 alpha1
                          rareddy
                          • 10. Re: Unable to deploy a custome translator in 8.0 alpha1
                            rokhmanov

                            Thanks Ramesh, I was about to file a bug but noticed you did it already.