1 Reply Latest reply on Mar 7, 2008 2:13 AM by Soheil Hassas Yeganeh

    Extending RichFaces components using CDK

    Soheil Hassas Yeganeh Newbie

      Hi There,

      I have been using CDK for creating a tailor made DataTable for some specific application, be it good approach or not.

      I have create a separate project and create my component (that extends the DataTable component) there .
      So, I have an extra jar file for my components, name it extra-comp.jar

      Whenever mydatatable is rendered, A4J tries to load resources needed by the DataTable (e.g. data-table.js) .
      But, as long as the component is in my extra-comp.jar and resources are in another jar file, it can not load them.
      When I copy these resources into my extra-comp.jar no error occurs.

      How can I solve this problem without copying the resources into my extar-comp.jar?!! Can it be solved by changing the classloader configruations?

      org.ajax4jsf.resource.ResourceNotFoundException: Static resource not found for path org.richfaces.renderkit.html.images.TriangleIconDown
      at org.ajax4jsf.resource.ResourceBuilderImpl.createStaticResource(ResourceBuilderImpl.java:450)
      at org.ajax4jsf.resource.ResourceBuilderImpl.createResource(ResourceBuilderImpl.java:255)
      at org.ajax4jsf.renderkit.RendererBase.getResource(RendererBase.java:152)
      at org.ajax4jsf.renderkit.compiler.ResourceElement.findResource(ResourceElement.java:93)
      at org.ajax4jsf.renderkit.compiler.ResourceElement.getString(ResourceElement.java:81)
      at org.ajax4jsf.renderkit.compiler.ClassElement.getString(ClassElement.java:94)
      at org.ajax4jsf.renderkit.compiler.ClassElement.encode(ClassElement.java:59)
      at org.ajax4jsf.renderkit.compiler.ElementBase.encode(ElementBase.java:105)
      at org.ajax4jsf.renderkit.compiler.ElementBase.encode(ElementBase.java:105)
      at org.ajax4jsf.renderkit.compiler.RootElement.encode(RootElement.java:64)
      at org.ajax4jsf.renderkit.compiler.ElementBase.encode(ElementBase.java:73)
      at org.ajax4jsf.resource.TemplateCSSRenderer.send(TemplateCSSRenderer.java:91)
      at org.ajax4jsf.resource.InternetResourceBase.send(InternetResourceBase.java:373)
      at org.ajax4jsf.resource.ResourceLifecycle.sendResource(ResourceLifecycle.java:223)
      at org.ajax4jsf.resource.ResourceLifecycle.send(ResourceLifecycle.java:148)
      at org.ajax4jsf.resource.InternetResourceService.load(InternetResourceService.java:336)
      at org.ajax4jsf.cache.LRUMapCache.load(LRUMapCache.java:116)
      at org.ajax4jsf.cache.LRUMapCache.get(LRUMapCache.java:87)
      at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:198)
      at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:144)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:265)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:613)


      I had also taken a look on ResourceBuilderImpl.java. Would you please let me know if it is better to load the resources using classloaders not the servlet context as it is done in ResourceBuilderImpl.java?!

      I mean a change like this:
      InputStream in = servletContext.getResourceAsStream(path); ---> InputStream in = classloader.getResourceAsStream(path)