7 Replies Latest reply on Aug 20, 2007 8:11 PM by Alex Grönholm

    Ajax4JSF mediaOutput tag and Seam

    Alex Grönholm Novice

      I'm trying to display thumbnails of images I have on the database using a4j:mediaoutput, like this:

      <a4j:mediaOutput element="img" mimeType="image/jpeg" createContent="#{download.sendThumbnail}" value="#{screenshot.id}" />

      The "download" component looks like this:
      @Name("download")
      @Stateless
      public class DownloadBean implements Download {
      
       @PersistenceContext
       private EntityManager em;
      
       @Override
       public void sendImage(OutputStream os, Object screenshotId) throws IOException {
       Screenshot ss = em.find(Screenshot.class, screenshotId);
       if (ss != null)
       os.write(ss.getImageData());
       }
      
       @Override
       public void sendThumbnail(OutputStream os, Object screenshotId) throws IOException {
       Screenshot ss = em.find(Screenshot.class, screenshotId);
       if (ss != null)
       os.write(ss.getThumbnailData());
       }
      
      }

      When loading the page, however, I get the following exception in the server console:
      00:49:02,174 ERROR [[default]] Servlet.service() for servlet default threw exception
      javax.faces.el.EvaluationException: /entry.xhtml @170,79 createContent="#{download.sendThumbnail}": Target Unreachable, identifier 'download' resolved to null
       at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
       at org.ajax4jsf.framework.resource.UserResource.send(UserResource.java:110)
       at org.ajax4jsf.framework.resource.ResourceLifecycle.send(ResourceLifecycle.java:86)
       at org.ajax4jsf.framework.resource.InternetResourceService.sendResource(InternetResourceService.java:256)
       at org.ajax4jsf.framework.resource.InternetResourceService.serviceResource(InternetResourceService.java:240)
       at org.ajax4jsf.framework.resource.InternetResourceService.serviceResource(InternetResourceService.java:141)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:261)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:68)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:68)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:68)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:149)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       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:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:619)
      

      So how can it possibly be null? The "download" component is loaded ok, since it shows up in the Seam component list during deploy.
      What am I doing wrong? Could this be a configuration problem?
      Using JBoss 4.2.1GA, Seam CVS and Ajax4JSF v1.1.1.