6 Replies Latest reply on Sep 27, 2007 7:30 AM by Maksim Kaszynski

    CDK reference problem

    richajon Newbie

      Hi all, I hope someone can help me with this.

      I am trying to create a RichFaces component using the CDK by following the example on this web site:

      http://www.jroller.com/wesleyhales/entry/jsf_component_developmment_with_the

      I am using RF version 3.1.0 (svn)
      SVN: http://anonsvn.jboss.org/repos/richfaces/tags/3.1.0

      Everything works fine until I execute the 'mvn install -e'. It seem like the a4j references in the TestInput3.xml (component config descriptor file) are outdated: org.ajax4jsf.framework.taglib.HtmlComponentTagBase. This is automatically generated by maven and this class does not exist since the latest refactoring of... I guess I could manually edit that xml config file but I would like it to generate the correct class name to avoid manual work in the future.

      I tried with and whit out the maven profile configuration specified on the web page but it made no difference. Should something be done differently or is there some missing configuration / is the CDK outdated?

      Here is a detailled listing of my commands and their results:

      #/rf-svn/ui/create.bat TestInput3
      
      #/rf-svn/ui/mvn cdk:create
      
      ...
      [INFO] BUILD SUCCESSFUL
      ...
      
      #/rf-svn/ui/cd TestInput3
      
      #/rf-svn/ui/TestInput3/mvn cdk:create -U -cpu -Dname=TestInput3
      
      ...
      [INFO] BUILD SUCCESSFUL
      ...
      
      #/rf-svn/ui/TestInput3/mvn install -e
      
      E:\java\richfaces\richfaces-3.1.0\svn\trunk\ui\TestInput3>set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=512m
      + Error stacktraces are turned on.
      [INFO] Scanning for projects...
      WAGON_VERSION: 1.0-beta-2
      [INFO] ----------------------------------------------------------------------------
      [INFO] Building TestInput3
      [INFO] task-segment: [install]
      [INFO] ----------------------------------------------------------------------------
      [INFO] artifact org.apache.maven.plugins:maven-resources-plugin: checking for updates from repository.jboss.com
      [INFO] artifact org.apache.maven.plugins:maven-compiler-plugin: checking for updates from repository.jboss.com
      [INFO] artifact org.apache.maven.plugins:maven-surefire-plugin: checking for updates from repository.jboss.com
      [INFO] artifact org.apache.maven.plugins:maven-jar-plugin: checking for updates from repository.jboss.com
      [INFO] artifact org.apache.maven.plugins:maven-install-plugin: checking for updates from repository.jboss.com
      [INFO] snapshot org.ajax4jsf.cdk:maven-cdk-plugin:1.1.1-SNAPSHOT: checking for updates from maven.exadel.com
      [INFO] snapshot org.ajax4jsf.cdk:maven-cdk-plugin:1.1.1-SNAPSHOT: checking for updates from maven.exadel.com
      [INFO] snapshot org.ajax4jsf:cdk:1.1.1-SNAPSHOT: checking for updates from maven.exadel.com
      [INFO] snapshot org.ajax4jsf:cdk:1.1.1-SNAPSHOT: checking for updates from maven.exadel.com
      [INFO] snapshot org.ajax4jsf:master:1.1.1-SNAPSHOT: checking for updates from maven.exadel.com
      [INFO] snapshot org.ajax4jsf:master:1.1.1-SNAPSHOT: checking for updates from maven.exadel.com
      [INFO] Preparing cdk:generate
      [WARNING] Removing: generate from forked lifecycle, to prevent recursive invocation.
      [INFO] [resources:resources]
      [INFO] Using default encoding to copy filtered resources.
      [INFO] [compiler:compile]
      [INFO] Compiling 1 source file to E:\java\richfaces\richfaces-3.1.0\svn\trunk\ui\TestInput3\target\classes
      [INFO] snapshot org.ajax4jsf.cdk:generator:1.1.1-SNAPSHOT: checking for updates from maven.exadel.com
      [INFO] snapshot org.ajax4jsf.cdk:generator:1.1.1-SNAPSHOT: checking for updates from maven.exadel.com
      [INFO] snapshot org.ajax4jsf.cdk:compiler:1.1.1-SNAPSHOT: checking for updates from maven.exadel.com
      [INFO] snapshot org.ajax4jsf.cdk:compiler:1.1.1-SNAPSHOT: checking for updates from maven.exadel.com
      [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
      [INFO] Setting property: velocimacro.messages.on => 'false'.
      [INFO] Setting property: resource.loader => 'classpath'.
      [INFO] Setting property: resource.manager.logwhenfound => 'false'.
      [INFO] **************************************************************
      [INFO] Starting Jakarta Velocity v1.4
      [INFO] RuntimeInstance initializing.
      [INFO] Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
      [INFO] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
      [INFO] Resource Loader Instantiated: org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
      [INFO] ClasspathResourceLoader : initialization starting.
      [INFO] ClasspathResourceLoader : initialization complete.
      [INFO] ResourceCache : initialized. (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
      [INFO] Default ResourceManager initialization complete.
      [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
      [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
      [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
      [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Include
      [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
      [INFO] Created: 20 parsers.
      [INFO] Velocimacro : initialization starting.
      [INFO] Velocimacro : adding VMs from VM library template : VM_global_library.vm
      [ERROR] ResourceManager : unable to find resource 'VM_global_library.vm' in any resource loader.
      [INFO] Velocimacro : error using VM library template VM_global_library.vm : org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'VM_global_library.vm'
      [INFO] Velocimacro : VM library template macro registration complete.
      [INFO] Velocimacro : allowInline = true : VMs can be defined inline in templates
      [INFO] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
      [INFO] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
      [INFO] Velocimacro : initialization complete.
      [INFO] Velocity successfully started.
      [INFO] [cdk:generate {execution: default}]
      [INFO] Parse config file E:\java\richfaces\richfaces-3.1.0\svn\trunk\ui\TestInput3\src\main\config\component\TestInput3.xml
      [ERROR] superclass not found for tag TestInput3
      java.lang.ClassNotFoundException: org.ajax4jsf.framework.taglib.HtmlComponentTagBase
       at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at org.ajax4jsf.builder.config.ComponentBaseBean.checkProperties(ComponentBaseBean.java:159)
       at org.ajax4jsf.builder.config.ComponentBean.checkProperties(ComponentBean.java:132)
       at org.ajax4jsf.builder.config.BuilderConfig.checkComopnentProperties(BuilderConfig.java:450)
       at org.ajax4jsf.builder.mojo.GenerateMojo.createConfig(GenerateMojo.java:246)
       at org.ajax4jsf.builder.mojo.GenerateMojo.execute(GenerateMojo.java:89)
       at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
       at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
       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 org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
       at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
       at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
       at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      [INFO] Create class file org.richfaces.component.html.HtmlTestInput3
      ClassNotFoundException message: org.ajax4jsf.framework.renderer.ComponentVariables
      Error load class: org.ajax4jsf.framework.renderer.ComponentVariables
      [ERROR] Error on generate component
      org.ajax4jsf.builder.generator.GeneratorException: Error create Renderer Java file
       at org.ajax4jsf.builder.generator.RendererGenerator.createRenderer(RendererGenerator.java:182)
       at org.ajax4jsf.builder.generator.RendererGenerator.createFiles(RendererGenerator.java:113)
       at org.ajax4jsf.builder.mojo.GenerateMojo.execute(GenerateMojo.java:106)
       at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
       at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
       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 org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
       at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
       at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
       at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: org.ajax4jsf.templatecompiler.builder.CompilationException: Error create renderer variable variables with type org.ajax4jsf.framework.renderer.ComponentVariables
       at org.ajax4jsf.templatecompiler.builder.AbstractCompilationContext.addVariable(AbstractCompilationContext.java:321)
       at org.ajax4jsf.templatecompiler.builder.AbstractCompilationContext.setDefaultVariables(AbstractCompilationContext.java:356)
       at org.ajax4jsf.templatecompiler.builder.AbstractCompilationContext.<init>(AbstractCompilationContext.java:121)
       at org.ajax4jsf.builder.generator.RendererCompilationContext.<init>(RendererCompilationContext.java:45)
       at org.ajax4jsf.builder.generator.RendererGenerator.createRenderer(RendererGenerator.java:132)
       ... 20 more
      Caused by: java.lang.ClassNotFoundException
       at org.ajax4jsf.templatecompiler.builder.AbstractCompilationContext.loadClass(AbstractCompilationContext.java:346)
       at org.ajax4jsf.templatecompiler.builder.AbstractCompilationContext.addVariable(AbstractCompilationContext.java:317)
       ... 24 more
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Error in component generation
      
      Embedded error: Error create Renderer Java file
      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.apache.maven.lifecycle.LifecycleExecutionException: Error in component generation
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
       at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
       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 org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
       at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
       at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
       at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: org.apache.maven.plugin.MojoExecutionException: Error in component generation
       at org.ajax4jsf.builder.mojo.GenerateMojo.execute(GenerateMojo.java:219)
       at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
       ... 16 more
      Caused by: org.ajax4jsf.builder.generator.GeneratorException: Error create Renderer Java file
       at org.ajax4jsf.builder.generator.RendererGenerator.createRenderer(RendererGenerator.java:182)
       at org.ajax4jsf.builder.generator.RendererGenerator.createFiles(RendererGenerator.java:113)
       at org.ajax4jsf.builder.mojo.GenerateMojo.execute(GenerateMojo.java:106)
       ... 18 more
      Caused by: org.ajax4jsf.templatecompiler.builder.CompilationException: Error create renderer variable variables with type org.ajax4jsf.framework.renderer.ComponentVariables
       at org.ajax4jsf.templatecompiler.builder.AbstractCompilationContext.addVariable(AbstractCompilationContext.java:321)
       at org.ajax4jsf.templatecompiler.builder.AbstractCompilationContext.setDefaultVariables(AbstractCompilationContext.java:356)
       at org.ajax4jsf.templatecompiler.builder.AbstractCompilationContext.<init>(AbstractCompilationContext.java:121)
       at org.ajax4jsf.builder.generator.RendererCompilationContext.<init>(RendererCompilationContext.java:45)
       at org.ajax4jsf.builder.generator.RendererGenerator.createRenderer(RendererGenerator.java:132)
       ... 20 more
      Caused by: java.lang.ClassNotFoundException
       at org.ajax4jsf.templatecompiler.builder.AbstractCompilationContext.loadClass(AbstractCompilationContext.java:346)
       at org.ajax4jsf.templatecompiler.builder.AbstractCompilationContext.addVariable(AbstractCompilationContext.java:317)
       ... 24 more
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 10 seconds
      [INFO] Finished at: Tue Sep 25 10:22:06 EDT 2007
      [INFO] Final Memory: 10M/19M
      [INFO] ------------------------------------------------------------------------
      


        • 1. Re: CDK reference problem
          Maksim Kaszynski Apprentice

          Some API files have changed their locations, for instance,

          org.ajax4jsf.framework.taglib.HtmlComponentTagBase

          now resides in
          org.ajax4jsf.webapp.taglib


          Update config file, template file - and enjoy!



          • 2. Re: CDK reference problem
            richajon Newbie

            Hi, thanks for the quick reply.

            Now I get an error related to the renderer, this class is not specified in the config descriptor file.

            ClassNotFoundException message: org.ajax4jsf.framework.renderer.ComponentVariables
            Error load class: org.ajax4jsf.framework.renderer.ComponentVariables
            [ERROR] Error on generate component
            org.ajax4jsf.builder.generator.GeneratorException: Error create Renderer Java file
             at org.ajax4jsf.builder.generator.RendererGenerator.createRenderer(RendererGenerator.java:182)
             at org.ajax4jsf.builder.generator.RendererGenerator.createFiles(RendererGenerator.java:113)
             at org.ajax4jsf.builder.mojo.GenerateMojo.execute(GenerateMojo.java:106)
             at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
             at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
             at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
             at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
             at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
             at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
             at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
             at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
             at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
             at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
             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 org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
             at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
             at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
             at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
            Caused by: org.ajax4jsf.templatecompiler.builder.CompilationException: Error create renderer variable variables with type org.ajax4jsf.framework.renderer.ComponentVariables
             at org.ajax4jsf.templatecompiler.builder.AbstractCompilationContext.addVariable(AbstractCompilationContext.java:321)
             at org.ajax4jsf.templatecompiler.builder.AbstractCompilationContext.setDefaultVariables(AbstractCompilationContext.java:356)
             at org.ajax4jsf.templatecompiler.builder.AbstractCompilationContext.<init>(AbstractCompilationContext.java:121)
             at org.ajax4jsf.builder.generator.RendererCompilationContext.<init>(RendererCompilationContext.java:45)
             at org.ajax4jsf.builder.generator.RendererGenerator.createRenderer(RendererGenerator.java:132)
             ... 20 more
            Caused by: java.lang.ClassNotFoundException
             at org.ajax4jsf.templatecompiler.builder.AbstractCompilationContext.loadClass(AbstractCompilationContext.java:346)
             at org.ajax4jsf.templatecompiler.builder.AbstractCompilationContext.addVariable(AbstractCompilationContext.java:317)
             ... 24 more
            


            Any idea?

            • 3. Re: CDK reference problem
              richajon Newbie

              [update]

              In the .jspx template I see a reference to the following class:
              org.ajax4jsf.framework.renderer.AjaxComponentRendererBase

              I think it might be the cause of the problem I specified in my previous post. What would be the replacement for this class?

              thanks.

              • 4. Re: CDK reference problem
                richajon Newbie

                Hi

                I found the problem. I had to change:

                the plugin section the pom.xml of my component from:

                ...
                 <groupId>org.ajax4jsf.cdk</groupId>
                 <artifactId>maven-cdk-plugin</artifactId>
                 <version>1.1.1-SNAPSHOT</version>
                ...
                


                to

                ...
                 <groupId>org.richfaces.cdk</groupId>
                 <artifactId>maven-cdk-plugin</artifactId>
                 <version>3.2.0-SNAPSHOT</version>
                ...
                


                and the class reference in my template file TestInput1.jspx to:
                baseclass="org.richfaces.renderkit.InputRendererBase"

                --

                But... how come the CDK generate pom file pointing to version 1.1.1? If anyone have a hint, let me know, it would be appreciated.

                • 5. Re: CDK reference problem
                  richajon Newbie

                  Found the problem...

                  the create.bat is not up to date, it creates component with the wrong CDK plugin information in the pom.xml

                  • 6. Re: CDK reference problem
                    Maksim Kaszynski Apprentice

                    Thanks for pointing.
                    Fixed .bat file.
                    Create.sh, however, was correct. :)