4 Replies Latest reply on Jul 14, 2007 2:57 PM by fabio quimbay

    Problem with <tr:inputFile> in Seam 1.2.1GA and Trinidad 1.0

    fabio quimbay Newbie

      Greetings ...

      I have a project with Seam 1.2.1GA and Trinidad 1.0.1 on JBoss 4.2.0GA, works good. Many components like <tr:panelPage> work good, bad when I use <tr:inputFile> doesn't work, because I see this error:

      09:30:22,875 ERROR [ExceptionFilter] uncaught exception
      javax.servlet.ServletException: /plantillas/subirPlantilla.xhtml @22,121 valueChangeListener="#{gestionPlantilla.fileUploaded}": javax.ejb.EJBTransactionRolledbackException: org.apache.myfaces.trinidadinternal.config.upload.UploadedFiles$FixFilename
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:154)
      ...
      ...
      Caused by: javax.faces.el.EvaluationException: /plantillas/subirPlantilla.xhtml @22,121 valueChangeListener="#{gestionPlantilla.fileUploaded}": javax.ejb.EJBTransactionRolledbackException: org.apache.myfaces.trinidadinternal.config.upload.UploadedFiles$FixFilename
       at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
      ...
      ...
      Caused by: javax.ejb.EJBTransactionRolledbackException: org.apache.myfaces.trinidadinternal.config.upload.UploadedFiles$FixFilename
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
      ...
      ...
      Caused by: java.lang.ClassCastException: org.apache.myfaces.trinidadinternal.config.upload.UploadedFiles$FixFilename
       at com.colconnect.reel.session.GestionPlantilla.fileUploaded(GestionPlantilla.java:58)
      ...
      ...
      


      it was when I return the event.getNewValue():

       public void fileUploaded(ValueChangeEvent event)
       {
       UploadedFile archivo = (UploadedFile) event.getNewValue();
       if (archivo != null) {
       archivoPlantilla = archivo;
       }
       }
      


      and my view is like this:

      ...
      ...
      <tr:inputFile label="#{messages['plantilla.contenido']}" valueChangeListener="#{gestionPlantilla.fileUploaded}" />
      ...
      ...
      


      Any idea. Thanks, for your help.

        • 1. Re: Problem with <tr:inputFile> in Seam 1.2.1GA and Trinidad
          Pete Muir Master

          s:fileUpload and tr:inputFile interfere with each other. It's not easy to work around this I'm afraid (you need to disable the MultipartFilter).

          • 2. Re: Problem with <tr:inputFile> in Seam 1.2.1GA and Trinidad
            fabio quimbay Newbie

            Hi, Pete ...

            In my web.xml by default I don't reference the MultipartFilter like in MyFaces. I put this about the Upload, no more ... :

            ...
            <context-param>
             <param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_MEMORY</param-name>
             <param-value>2048000</param-value>
             </context-param>
             <context-param>
             <param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_DISK_SPACE</param-name>
             <param-value>20480000</param-value>
             </context-param>
            ...
            


            Am I forgot anything related with Trinidad's Upload Component ? Is a very strange situation, because I have a project with MyFaces 1.1.4 and Trinidad 1.0.0 on JBoss 4.0.5 .. and works successfully ..


            • 3. Re: Problem with <tr:inputFile> in Seam 1.2.1GA and Trinidad
              Pete Muir Master

              No its installed by the Seam Filter by default. You'll need to disable it (no easy way to do this).

              • 4. Re: Problem with <tr:inputFile> in Seam 1.2.1GA and Trinidad
                fabio quimbay Newbie

                Hi, Pete ...

                This in my web.xml:


                <?xml version="1.0" encoding="UTF-8"?>
                <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
                <!-- ************************ SEAM Config ****************************
                300 second conversation timeout -->
                <context-param>
                <param-name>org.jboss.seam.core.manager.conversationTimeout</param-name>
                <param-value>300000</param-value>
                </context-param>
                <context-param>
                <param-name>org.jboss.seam.core.init.debug</param-name>
                <param-value>true</param-value>
                </context-param>
                <!-- ************************ JSF Config **************************** -->
                <context-param>
                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                <param-value>.xhtml</param-value>
                </context-param>
                <context-param>
                <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                <param-value>client</param-value>
                </context-param>
                <!-- ************************ FACELETS Config **************************** -->
                <context-param>
                <param-name>facelets.DEVELOPMENT</param-name>
                <param-value>true</param-value>
                </context-param>
                <context-param>
                <param-name>facelets.REFRESH_PERIOD</param-name>
                <param-value>2</param-value>
                </context-param>
                <context-param>
                <description>Prevents HTML-Comments from beeing rendered</description>
                <param-name>facelets.SKIP_COMMENTS</param-name>
                <param-value>true</param-value>
                </context-param>
                <!-- ************************ AJAX4JSF Config ****************************
                Do not use with Trinidad.
                <context-param>
                <param-name>org.ajax4jsf.SKIN</param-name>
                <param-value>DEFAULT</param-value>
                </context-param>
                ************************ Trinidad Config **************************** -->
                <context-param>
                <param-name>org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE</param-name>
                <param-value>false</param-value>
                </context-param>
                <context-param>
                <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
                <param-value>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</param-value>
                <!--<param-value>com.sun.facelets.FaceletViewHandler</param-value>-->
                </context-param>
                <context-param>
                <param-name>org.apache.myfaces.trinidadinternal.DISABLE_CONTENT_COMPRESSION</param-name>
                <param-value>true</param-value>
                </context-param>
                <!-- If this parameter is enabled, Trinidad will automatically
                check the modification date of your JSPs, and discard saved
                state when they change; this makes development easier,
                but adds overhead that should be avoided when your application
                is deployed -->
                <context-param>
                <param-name>org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION</param-name>
                <param-value>true</param-value>
                </context-param>
                <context-param>
                <!-- Maximum memory per request (in bytes) -->
                <param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_MEMORY</param-name>
                <!-- Use 2000K -->
                <param-value>2048000</param-value>
                </context-param>
                <context-param>
                <!-- Maximum disk space per request (in bytes) -->
                <param-name>org.apache.myfaces.trinidad.UPLOAD_MAX_DISK_SPACE</param-name>
                <!-- Use 20,000K -->
                <param-value>20480000</param-value>
                </context-param>
                <!-- ************************ AJAX4JSF Filter ****************************
                If you have other filters declared in the web.xml, be sure that Ajax4jsf Filter is declared before the others. -->
                <filter>
                <display-name>Ajax4jsf Filter</display-name>
                <filter-name>ajax4jsf</filter-name>
                <filter-class>org.ajax4jsf.Filter</filter-class>
                <init-param>
                <param-name>forceparser</param-name>
                <param-value>false</param-value>
                </init-param>
                </filter>
                <!-- ************************ Trinidad Filter **************************** -->
                <filter>
                <filter-name>Trinidad</filter-name>
                <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
                </filter>
                <!-- ************************ Seam Filter ****************************

                <filter>
                <filter-name>Seam Filter</filter-name>
                <filter-class>org.jboss.seam.web.SeamFilter</filter-class>
                </filter>
                -->
                <filter-mapping>
                <filter-name>ajax4jsf</filter-name>
                <url-pattern>*.seam</url-pattern>
                </filter-mapping>
                <filter-mapping>
                <filter-name>Trinidad</filter-name>
                <url-pattern>*.seam</url-pattern>
                </filter-mapping>
                <!--
                <filter-mapping>
                <filter-name>Seam Filter</filter-name>
                <url-pattern>/*</url-pattern>
                </filter-mapping>

                ************************ SEAM Listener **************************** -->
                <listener>
                <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
                </listener>
                <listener>
                <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
                </listener>
                <!-- ************************ SEAM Servlet Mapping ************************ -->
                <servlet>
                <servlet-name>Seam Resource Servlet</servlet-name>
                <servlet-class>org.jboss.seam.servlet.ResourceServlet</servlet-class>
                </servlet>
                <!-- ************************ Faces Servlet Mapping **************************** -->
                <servlet>
                <servlet-name>Faces Servlet</servlet-name>
                <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
                </servlet>
                <!-- ************************ Trinidad resources servlet **************************** -->
                <servlet>
                <servlet-name>Trinidad Resources</servlet-name>
                <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
                </servlet>
                <servlet-mapping>
                <servlet-name>Seam Resource Servlet</servlet-name>
                <url-pattern>/seam/resource/*</url-pattern>
                </servlet-mapping>
                <servlet-mapping>
                <servlet-name>Faces Servlet</servlet-name>
                <url-pattern>*.seam</url-pattern>
                </servlet-mapping>
                <!-- This cannot be configured currently -->
                <servlet-mapping>
                <servlet-name>Trinidad Resources</servlet-name>
                <url-pattern>/adf/*</url-pattern>
                </servlet-mapping>
                <!-- ************************ Misc **************************** -->
                <session-config>
                <session-timeout>30</session-timeout>
                </session-config>
                <security-constraint>
                <display-name>Restrict raw XHTML Documents</display-name>
                <web-resource-collection>
                <web-resource-name>XHTML</web-resource-name>
                <url-pattern>*.xhtml</url-pattern>
                </web-resource-collection>
                <auth-constraint>
                <role-name>NONE</role-name>
                </auth-constraint>
                </security-constraint>
                <login-config>
                <auth-method>BASIC</auth-method>
                </login-config>
                </web-app>


                Like you see, I comment all about the Seam Filter, but doesn't work, I see this, when I use the <tr:inputFile> component:


                13:45:10,125 ERROR [[Faces Servlet]] Servlet.service() para servlet Faces Servlet lanzó excepción
                java.lang.ClassCastException: org.apache.myfaces.trinidadinternal.config.upload.UploadedFiles$FixFilename
                at com.colconnect.reel.session.GestionPlantilla.fileUploaded(GestionPlantilla.java:59)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
                at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
                at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:37)
                at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
                at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
                at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:37)
                at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                at org.jboss.seam.interceptors.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:63)
                at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
                at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
                at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
                at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
                at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
                at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
                at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:204)
                at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:100)
                at $Proxy180.fileUploaded(Unknown Source)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
                at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
                at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
                at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
                at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
                at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
                at org.javassist.tmp.java.lang.Object_$$_javassist_21.fileUploaded(Object_$$_javassist_21.java)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at com.sun.el.parser.AstValue.invoke(AstValue.java:174)
                at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:286)
                at org.jboss.seam.ui.facelet.OptionalParameterMethodExpression.invoke(OptionalParameterMethodExpression.java:34)
                at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
                at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1171)
                at org.apache.myfaces.trinidad.component.UIXEditableValue.broadcast(UIXEditableValue.java:213)
                at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
                at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:156)
                at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:62)
                at org.ajax4jsf.framework.ajax.AjaxContext.invokeOnRegionOrRoot(AjaxContext.java:176)
                at org.ajax4jsf.framework.ajax.AjaxViewRoot.processValidators(AjaxViewRoot.java:315)
                at org.apache.myfaces.lifecycle.ProcessValidationsExecutor.execute(ProcessValidationsExecutor.java:32)
                at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
                at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:208)
                at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:165)
                at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:138)
                at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
                at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
                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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                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:156)
                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(Unknown Source)
                13:45:10,156 ERROR [CachedConnectionValve] Application error: Faces Servlet did not complete its transaction


                Pete, I will try to use other versions of this tools ... and I will say you what happening with this. Thanks for your help and attention.