2 Replies Latest reply on Jan 17, 2007 10:42 AM by Stephen Williams

    a4j:mediaOutput and SeamFaceletViewHandler

    Johannes Behrndt Newbie

      Hi,

      I've run into a problem using a4j:mediaOutput from the ajax4jsf library for displaying an image retrieved from my db.
      When I'm trying to load the page I get the following exception from the ajax4jsf-call:

      06:19:27,765 ERROR [SeamExceptionFilter] uncaught exception handled by Seam
      java.lang.IllegalStateException: No application context active
       at org.jboss.seam.Component.forName(Component.java:1439)
       at org.jboss.seam.Component.getInstance(Component.java:1479)
       at org.jboss.seam.Component.getInstance(Component.java:1467)
       at org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:45)
       at org.apache.myfaces.custom.redirectTracker.RedirectTrackerVariableResolver.resolveVariable(RedirectTrackerVariableResolver.java:38)
       at org.apache.myfaces.config.LastVariableResolverInChain.resolveVariable(LastVariableResolverInChain.java:42)
       at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:134)
       at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
       at com.sun.el.parser.AstValue.getTarget(AstValue.java:62)
       at com.sun.el.parser.AstValue.invoke(AstValue.java:147)
       at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
       at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
       at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
       at org.ajax4jsf.framework.resource.UserResource.send(UserResource.java:92)
       at org.ajax4jsf.framework.resource.ResourceLifecycle.send(ResourceLifecycle.java:79)
       at org.ajax4jsf.framework.resource.InternetResourceService.sendResource(InternetResourceService.java:191)
       at org.ajax4jsf.framework.resource.InternetResourceService.serviceResource(InternetResourceService.java:176)
       at org.ajax4jsf.framework.resource.InternetResourceService.serviceResource(InternetResourceService.java:96)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:210)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at de.teachers24.util.LoginRequestParamFilter.doFilter(LoginRequestParamFilter.java:23)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at de.teachers24.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:30)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      


      Alle the other ajax4jsf-tags work fine in my environment. It looks like it fails when trying to resolve an EL expression. I am not resolving any expressions in my code of the method for generationg the outputstream.
      Even if I don't declare it as Seam component but instead as an mbean (so not using any Seam-related stuff inside) I get the same exception.
      I am using jboss-seam-CVS.20061030 with AS 4.0.5, myfaces and facelets and the SeamFaceletViewHandler for the EL enhancements.

      Any ideas?

        • 1. Re: a4j:mediaOutput and SeamFaceletViewHandler
          Joseph Miller Newbie

          I get a very similar exception myself, using Seam 1.1GA, and Ajax4JSF 1.0.5 with the <a4j:mediaOutput> tag.

          I'm wanting to display an image I have stored in my database, but also, in order to eliminate mis-configuration of my own application as a factor, I've modified the Hotel booking example thus:

          in Hotel.java, I've added:

          @Transient private byte[] image;
          
          public Hotel() {
           try {
           FileInputStream fis = new FileInputStream("/testimage.png");
           image = new byte[8000];
           fis.read(image);
           } catch (Exception e) {
           e.printStackTrace();
           }
           }
          
           public void renderImage(OutputStream out, Object data) throws IOException {
           out.write(this.image);
           }


          and in view/hotel.xhtml:
          <div class="label">Image:</div>
           <div class="output">
           <a4j:mediaOutput createContent="#{hotel.renderImage}" value="#{hotel.name}.png" element="img" mimeType="image/png" />
           </div>


          and I get this exception:
          ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/seam-booking].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
          
          java.lang.IllegalStateException: No application context active
           at org.jboss.seam.Component.forName(Component.java:1559)
           at org.jboss.seam.Component.getInstance(Component.java:1609)
           at org.jboss.seam.Component.getInstance(Component.java:1592)
           at org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:46)
           at org.apache.myfaces.config.LastVariableResolverInChain.resolveVariable(LastVariableResolverInChain.java:42)
           at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:134)
           at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
           at com.sun.el.parser.AstValue.getTarget(AstValue.java:62)
           at com.sun.el.parser.AstValue.invoke(AstValue.java:147)
           at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
           at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
           at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
           at org.ajax4jsf.framework.resource.UserResource.send(UserResource.java:92)
           at org.ajax4jsf.framework.resource.ResourceLifecycle.send(ResourceLifecycle.java:79)
           at org.ajax4jsf.framework.resource.InternetResourceService.sendResource(InternetResourceService.java:192)
           at org.ajax4jsf.framework.resource.InternetResourceService.serviceResource(InternetResourceService.java:177)
           at org.ajax4jsf.framework.resource.InternetResourceService.serviceResource(InternetResourceService.java:97)
           at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:200)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
           at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
           at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
           at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
           at java.lang.Thread.run(Thread.java:595)



          Can someone help?

          • 2. Re: a4j:mediaOutput and SeamFaceletViewHandler
            Stephen Williams Newbie

            Hi!

            I have the same problem as these guys. I also found the following post of someone else with this problem but until now no solution.

            http://www.nabble.com/mediaOutput-Seam-1.1-with-facelets-t2917705.html

            I am also using Seam 1.1GA with Ajax4JSF 1.0.5

            Any help with this would be greatly appreciated.

            tooteloo