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
In htmlcomponents.xhtml I thought the following would work but it doesn't :
<h:graphicImage value="book.gif" height="200" width="320" library="images"/>
The weird thing is on the JSF 2.0 spec there's the following written :
<h:graphicImage name="Planets.gif" library="images"/>
But when I use the name attributed instead of the value I get the following
exception. Any idea ?
Thanks,
Antonio
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)