1 Reply Latest reply on Sep 22, 2008 2:45 PM by Jason Suplizio

    CDK Guide

    Jason Suplizio Newbie

      I've followed your CDK guide exactly as documented and I've encountered a problem that is a show stopper. Using the CDK documentation, how do I do a 'mvn install' to get the 'InputDateRenderer' to extend 'InputDateRendererBase'?

      Here's the problem: when I invoke 'mvn clean install', 'InputDateRenderer' is created extending not 'InputDateRendererBase' but rather 'AjaxComponentRendererBase'. The problem is that the 'AjaxComponentRendererBase' does not have a

      getValueAsString()
      method, which is causing a compilation error. Your distribution contains a jar that does indeed contain the 'InputDateRenderer' extending 'InputDateRendererBase'

      \docs\cdkguide\en\src\main\resources\examples\inputDate-1.0-SNAPSHOT.jar

      Btw, I've customized the packages structure and used a different artifactId - (its broken using the example's naming as well) and used the following command to create the archive:
      mvn archetype:create -DarchetypeGroupId=org.richfaces.cdk -DarchetypeArtifactId=maven-archetype-jsf-component -DarchetypeVersion=3.2.1.GA -DartifactId=platformCdkLibrary


      I'm using JDK 1.5, RichFaces (tried both 3.2.1 and 3.2.2), and maven 2.0.9 and this error occurs using the command line or the eclipse maven plugin.

      + Error stacktraces are turned on.
      [INFO] Scanning for projects...
      [INFO] ----------------------------------------------------------------------------
      [INFO] Building PlatformCdkLibrary
      [INFO] task-segment: [clean, install]
      [INFO] ----------------------------------------------------------------------------
      [INFO] [clean:clean]
      [INFO] Deleting directory c:\cdkTest\PlatformCdkLibrary\target
      [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 2 source files to c:\cdkTest\PlatformCdkLibrary\target\classes
      [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,cdk'.
      [INFO] Setting property: resource.manager.logwhenfound => 'false'.
      [INFO] Setting property: cdk.resource.loader.class => 'org.ajax4jsf.builder.velocity.ResourceLoader'.
      [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] Resource Loader Instantiated: org.ajax4jsf.builder.velocity.ResourceLoader
      [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
      [INFO] Velocimacro : added new VM : #quietnull( a ) : source = VM_global_library.vm
      [INFO] Velocimacro : added new VM : #tagPropertyMethods12( source ) : source = VM_global_library.vm
      [INFO] Velocimacro : added new VM : #tagPropertyRelease( source ) : source = 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 c:\cdkTest\PlatformCdkLibrary\src\main\config\component\inputDate.xml
      [ERROR] Class java.lang.String for property value not equals with real bean property type: java.lang.Object
      [ERROR] Class java.lang.String for property value not equals with real bean property type: java.lang.Object
      [ERROR] Class java.lang.String for property value not equals with real bean property type: java.lang.Object
      [ERROR] Class java.lang.String for property value not equals with real bean property type: java.lang.Object
      [ERROR] Class java.lang.String for property value not equals with real bean property type: java.lang.Object
      [INFO] Create tag class file com.expd.app.reportingplatform.view.jsf.richfaces.component.html.HtmlInputDate
      [INFO] Component com.expd.app.reportingplatform.view.jsf.richfaces.InputDate included in taglib PlatformCdkLibrary
      [INFO] Component com.expd.app.reportingplatform.view.jsf.richfaces.InputDate included to taglib PlatformCdkLibrary
      [INFO] [resources:resources]
      [INFO] Using default encoding to copy filtered resources.
      [INFO] [compiler:compile]
      [INFO] Compiling 3 source files to c:\cdkTest\PlatformCdkLibrary\target\classes
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Compilation failure
      c:\cdkTest\PlatformCdkLibrary\target\generated-component\java\com\expd\app\reportingplatform\view\jsf\richfaces\renderkit\html\InputDateRenderer.java:[182,91] cannot find symbol
      symbol : method getValueAsString(javax.faces.context.FacesContext,com.expd.app.reportingplatform.view.jsf.richfaces.component.UIInputDate)
      location: class com.expd.app.reportingplatform.view.jsf.richfaces.renderkit.html.InputDateRenderer



      c:\cdkTest\PlatformCdkLibrary\target\generated-component\java\com\expd\app\reportingplatform\view\jsf\richfaces\renderkit\html\InputDateRenderer.java:[182,91] cannot find symbol
      symbol : method getValueAsString(javax.faces.context.FacesContext,com.expd.app.reportingplatform.view.jsf.richfaces.component.UIInputDate)
      location: class com.expd.app.reportingplatform.view.jsf.richfaces.renderkit.html.InputDateRenderer


      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.apache.maven.BuildFailureException: Compilation failure
      c:\cdkTest\PlatformCdkLibrary\target\generated-component\java\com\expd\app\reportingplatform\view\jsf\richfaces\renderkit\html\InputDateRenderer.java:[182,91] cannot find symbol
      symbol : method getValueAsString(javax.faces.context.FacesContext,com.expd.app.reportingplatform.view.jsf.richfaces.component.UIInputDate)
      location: class com.expd.app.reportingplatform.view.jsf.richfaces.renderkit.html.InputDateRenderer


      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:560)
      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:585)
      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.CompilationFailureException: Compilation failure
      c:\cdkTest\PlatformCdkLibrary\target\generated-component\java\com\expd\app\reportingplatform\view\jsf\richfaces\renderkit\html\InputDateRenderer.java:[182,91] cannot find symbol
      symbol : method getValueAsString(javax.faces.context.FacesContext,com.expd.app.reportingplatform.view.jsf.richfaces.component.UIInputDate)
      location: class com.expd.app.reportingplatform.view.jsf.richfaces.renderkit.html.InputDateRenderer


      at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
      at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
      ... 16 more
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 7 seconds
      [INFO] Finished at: Mon Sep 22 11:12:10 PDT 2008
      [INFO] Final Memory: 12M/22M
      [INFO] ------------------------------------------------------------------------


        • 1. Re: CDK Guide
          Jason Suplizio Newbie

          Problem solved and (thank you for your guide).

          I spent too much time figuring this out only to solve the problem minutes of posting a question to the forum (of course). The problem is that the CDK guide section 4.4.1 doesn't say that the baseclass value of the htmlInputDate.jspx file must be modified to reference the 'InputDateRendererBase'. The Note, below is not explicit enough:

          As it is seen in the Template Skeleton the Renderer Baseclass is org.ajax4jsf.renderkit.AjaxComponentRendererBase. You need to define Renderer Base class special for the component. In the next section "Creating a Renderer Base class" we will create Renderer Base class org.mycompany.renderkit.InputDateRendererBase.

          Below is the modified template required to successfully compile:

          <?xml version="1.0" encoding="UTF-8"?>
          <f:root
           xmlns:f="http://ajax4jsf.org/cdk/template"
           xmlns:c=" http://java.sun.com/jsf/core"
           xmlns:ui=" http://ajax4jsf.org/cdk/ui"
           xmlns:u=" http://ajax4jsf.org/cdk/u"
           xmlns:x=" http://ajax4jsf.org/cdk/x"
           class="org.mycompany.renderkit.html.InputDateRenderer"
           baseclass="org.ajax4jsf.renderkit.InputDateRendererBase"
           component="org.mycompany.component.UIInputDate" >
          ...
          
          </f:root>


          Keep up the great work!