Skip to main content

[webtier] Re: Fwd: JSF 2.0 and resource management

1 reply [Last post]
Anonymous

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Ryan Lubke

>
> Hi,
>
> I'm trying to use the new resource management of JSF 2.0. I have
> packaged a image (book.gif) into a jar file (images.jar). I've put
> this jar under /resources in my war file. So I have the following
> structure :
>
> index.xhtml
> +-ex06/htmlcomponents.xhtml
> +-resources/images.jar
> +-WEB-INF/classes/MyManagedBean
The packaging is incorrect. If you have resources within a jar, then
the jar should be placed in WEB-INF/lib and the resources
within the jar should be in META-INF/resources. If you're placing
resources within the context root, then you would place the
actual images, css, etc in /resources.

Might consider looking over this information on resources [1].
>
> In htmlcomponents.xhtml I thought the following would work but it
> doesn't :
>
> > library="images"/>
>
> The weird thing is on the JSF 2.0 spec there's the following written :
>
>
This is the correct format when using the resource system.
See [2] for details.
>
> But when I use the name attributed instead of the value I get the
> following exception. Any idea ?
>
> Thanks,
> Antonio
>
NPE is a known issue [3] and is thrown when a resource isn't found.

[1] http://blogs.sun.com/rlubke/entry/jsf_2_0_new_feature5
[2]
https://javaserverfaces.dev.java.net/nonav/docs/pr/pdldocs/facelets/h/gr...
[3] https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=843

>
> GRAVE: Error Rendering View[/ex06/htmlcomponents.xhtml]
> java.lang.NullPointerException
> at
> com.sun.faces.renderkit.html_basic.ImageRenderer.src(ImageRenderer.java:135)
> at
> com.sun.faces.renderkit.html_basic.ImageRenderer.encodeEnd(ImageRenderer.java:100)
> at
> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879)
> at
> javax.faces.component.UIComponent.encodeAll(UIComponent.java:1509)
> at
> javax.faces.component.UIComponent.encodeAll(UIComponent.java:1505)
> at
> com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:228)
> at
> com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:152)
> at
> com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:97)
> at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:102)
> at
> com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:311)
> at
> org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:465)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:306)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:656)
> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
> at
> com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
> at
> org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:346)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:244)
> at
> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:180)
> at
> com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:646)
> at
> com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
> at
> com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:821)
> at
> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:153)
> at
> com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:71)
> at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
> at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
> at
> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
> at
> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
> at
> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
> at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> 19 fÚvr. 2009 15:49:12 org.apache.catalina.core.StandardWrapperValve log
> GRAVE: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service()
> for servlet Faces Servlet threw exception
> java.lang.NullPointerException
> at
> com.sun.faces.renderkit.html_basic.ImageRenderer.src(ImageRenderer.java:135)
> at
> com.sun.faces.renderkit.html_basic.ImageRenderer.encodeEnd(ImageRenderer.java:100)
> at
> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879)
> at
> javax.faces.component.UIComponent.encodeAll(UIComponent.java:1509)
> at
> javax.faces.component.UIComponent.encodeAll(UIComponent.java:1505)
> at
> com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:228)
> at
> com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:152)
> at
> com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:97)
> at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:102)
> at
> com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:311)
> at
> org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:465)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:306)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:656)
> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
> at
> com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
> at
> org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:346)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:244)
> at
> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:180)
> at
> com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:646)
> at
> com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
> at
> com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:821)
> at
> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:153)
> at
> com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:71)
> at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
> at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
> at
> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
> at
> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
> at
> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
> at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
>
>
>
>
> --
> --
> Antonio Goncalves (antonio.goncalves@gmail.com
> )
> Software architect
>
> Paris JUG leader : www.parisjug.org
> Web site : www.antoniogoncalves.org
> Blog: jroller.com/agoncal
> LinkedIn: www.linkedin.com/in/agoncal

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net