4 Replies Latest reply on Jan 25, 2012 3:48 PM by pepelara

    com.sun.faces.application.resource.ResourceHandlerImp

    pepelara

      I am trying a very simple CRUD project and I get an exception
      on rendering to home.xhtml.


      It is as follows,


      00:18:15,484 GRAVE javax.enterprise.resource.webcontainer.jsf.application (http--127.0.0.1-8180-1) Error Rendering View /home.xhtml: javax.el.ELException: /home.xhtml: Can not convert com.sun.faces.application.resource.ResourceHandlerImpl@8a8297 from type class com.sun.faces.application.resource.ResourceHandlerImpl to Number
           at com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:96) jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT
           at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82) jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT
           at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183) jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759) jboss-jsf-api2.1spec-2.0.0.Beta1.jar:2.0.0.Beta1
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759) jboss-jsf-api2.1spec-2.0.0.Beta1.jar:2.0.0.Beta1
           at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401) jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT
           at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT
           at com.ocpsoft.pretty.faces.application.PrettyViewHandler.renderView(PrettyViewHandler.java:163) prettyfaces-jsf2-3.3.2.jar:
           at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) jboss-jsf-api2.1spec-2.0.0.Beta1.jar:2.0.0.Beta1
           at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) jboss-jsf-api2.1spec-2.0.0.Beta1.jar:2.0.0.Beta1
           at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT
           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT
           at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) jboss-jsf-api2.1spec-2.0.0.Beta1.jar:2.0.0.Beta1
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:126) prettyfaces-jsf2-3.3.2.jar:
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:541) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118) prettyfaces-jsf2-3.3.2.jar:
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139) jboss-as-web-7.0.2.Final.jar:7.0.2.Final
           at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) jboss-as-web-7.0.2.Final.jar:7.0.2.Final
           at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) jboss-as-jpa-7.0.2.Final.jar:7.0.2.Final
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at java.lang.Thread.run(Thread.java:662)
      Caused by: java.lang.IllegalArgumentException: No puedo convertir com.sun.faces.application.resource.ResourceHandlerImpl@8a8297 desde tipo class com.sun.faces.application.resource.ResourceHandlerImpl a Number
           at org.apache.el.lang.ELArithmetic.coerce(ELArithmetic.java:408) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.el.lang.ELArithmetic.divide(ELArithmetic.java:334) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.el.parser.AstDiv.getValue(AstDiv.java:40) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:187) jbossweb-7.0.1.Final.jar:7.0.2.Final
           at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:55) weld-core-1.1.2.Final.jar:2011-07-26 15:02
           at com.sun.faces.facelets.el.ELText$ELTextVariable.toString(ELText.java:214) jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT
           at com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:89)  jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT
           ... 38 more


      00:18:15,500 INFO  org.jboss.seam.examples.empleados.exceptioncontrol.GeneralExceptionHandler (http--127.0.0.1-8180-1) Exception logged by seam-catch catcher: Can not convert com.sun.faces.application.resource.ResourceHandlerImpl@8a8297 from type class com.sun.faces.application.resource.ResourceHandlerImpl to Number


      being org.jboss.seam.examples.empleados.exceptioncontrol.GeneralExceptionHandler the same class as the one in Seam 3.1.0.Final seam-booking example.


      I am deploying the webapp on JBoss AS Web 7.0.2.Final

        • 1. Re: com.sun.faces.application.resource.ResourceHandlerImp
          lightguard

          Could you please post your facelets page?

          • 2. Re: com.sun.faces.application.resource.ResourceHandlerImp
            pepelara

            I am using booking example as starting point. The next step is customizer the webapp to create a real CRUD project.


            Here is the template.xhtml file in WEB-INF/layout


            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml"
                  xmlns:ui="http://java.sun.com/jsf/facelets"
                  xmlns:h="http://java.sun.com/jsf/html"
                  xmlns:pretty="http://ocpsoft.com/prettyfaces"
                  xmlns:f="http://java.sun.com/jsf/core">
            <f:view>
                <ui:insert name="metadata"/>
                <h:head>
                    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
                    <title>#{bundles.messages.template_title}</title>
                    <link rel="shortcut icon" href="#{request.contextPath}/favicon.ico"/>
            
                    <h:outputStylesheet library="css" name="booking.css"/>
                    <ui:insert name="head"/>
                </h:head>
                <h:body styleClass="#{empty pageClass ? 'page' : 'home'}">
                    <div id="document">
                        <div id="header">
                            <div id="title">
                                <h:graphicImage value="/img/hdr.title.gif" alt="JBoss Suites banner"/>
                            </div>
                            <h:form id="menuForm">
                                <div id="status">
                                    <h:outputText value="(#{currentUser.name})" rendered="#{identity.loggedIn}" styleClass="user"/>
                                    #{' '}
                                    <pretty:link mappingId="home">#{bundles.messages.template_linkHome}</pretty:link>
                                    #{' | '}
                                    <h:link id="search" outcome="/search.xhtml" value="#{bundles.messages.template_linkHotels}"/>
                                    <h:panelGroup rendered="#{not identity.loggedIn}">
                                        #{' | '}
                                        <pretty:link mappingId="home">#{bundles.messages.template_linkLogin}</pretty:link>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{identity.loggedIn}">
                                        #{' | '}
                                        <pretty:link mappingId="account">#{bundles.messages.template_linkAccount}</pretty:link>
                                        #{' | '}
                                        <pretty:link mappingId="logout">#{bundles.messages.template_linkLogout}</pretty:link>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{facesContext.application.projectStage == 'Development'}">
                                        #{' | '}
                                        <h:commandLink action="pretty:home"
                                                       actionListener="#{facesContext.externalContext.invalidateSession}"
                                                       value="#{bundles.messages.template_linkReset}"/>
                                    </h:panelGroup>
                                </div>
                            </h:form>
                        </div>
                        <div id="container">
                            <div id="sidebar">
                                <ui:insert name="sidebar"/>
                            </div>
                            <div id="content">
                                <ui:insert name="content"/>
                            </div>
                        </div>
                        <div id="footer">
                            #{bundles.messages.template_createdWith}<br/>
                            #{bundles.messages.template_projectStage}: #{initParam['javax.faces.PROJECT_STAGE']}
                            #{' | '}
                            #{bundles.messages.template_currentConversation}:
                            #{conversation.transient ? 'transient' : 'long-running, id: '.concat(conversation.id)}
                        </div>
                    </div>
                </h:body>
            </f:view>
            </html>
            



            This file has some issues an the line,


            <h:commandLink action="pretty:home"
             actionListener="#{facesContext.externalContext.invalidateSession}"
             value="#{bundles.messages.template_linkReset}"/>



            here Eclipse Indigo IDE says for the action value that it does not match
            a navigation case outcome. The other issue is on the actionListener, the IDE says that the method must have signature void method(ActionEvent) but has signature void method().


            And this is my home.xhtml file,


            <?xml version='1.0' encoding='UTF-8' ?>
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                            xmlns:ui="http://java.sun.com/jsf/facelets"
                            xmlns:f="http://java.sun.com/jsf/core"
                            xmlns:h="http://java.sun.com/jsf/html"
                            template="/WEB-INF/layout/template.xhtml">
            
                 <ui:param name="pageTitle" value="Welcome to Forge" />
            
                 <ui:define name="head">
                      <div class="section">
                        <h1>#{bundles.messages.home_header}</h1>
            
                        <p>#{bundles.messages.home_body}</p>
            
                        <p>#{bundles.messages.home_note}</p>
                    </div>
                 </ui:define>
            
                 <ui:define name="content">
                      <p>
                           <a target="_blank"
                                href="https://docs.jboss.org/author/display/FORGE">Documentation</a>
                           | <a target="_blank"
                                href="http://twitter.com/intent/tweet?text=I+just+built+and+deployed+a+webapp+using+%23Forge,+from+%23JBoss+-+Super+easy!+(+http://jboss.org/forge+)">Get
                                Excited!</a><br /> <a target="_blank" href="http://jboss.org/forge"><br />
                                Forge Project</a> | <a target="_blank"
                                href="https://lists.jboss.org/mailman/listinfo/forge-users">User
                                List</a> | <a target="_blank"
                                href="https://issues.jboss.org/browse/FORGE">Report an issue</a>
                      </p>
                      <p style="text-align: right; padding-top: 50px">
                           <a target="_blank" href="http://jboss.org"><img
                                src="#{resource/img['jboss-community.png']}"
                                alt="JBoss and JBoss Community" width="254" height="31" border="0" />
                           </a> <br /> To replace this page edit 'src/main/webapp/index.xhtml', or
                           keep Forging!
                      </p>
                 </ui:define>
                 
                 <ui:define name="sidebar">
                      <h:form id="login" rendered="#{not identity.loggedIn}">
                        <fieldset>
                            <div>
                                <h:outputLabel for="username" value="#{bundles.messages.home_usernameLabel}"/>
                                <h:inputText id="username" value="#{credentials.username}" style="width: 175px;"/>
                                <div class="errors">
                                    <h:message for="username"/>
                                </div>
                            </div>
                            <div>
                                <h:outputLabel for="password" value="#{bundles.messages.home_passwordLabel}"/>
                                <h:inputSecret id="password" value="#{credentials.password}" style="width: 175px;"/>
                            </div>
                        <span class="errors">
                           <h:messages errorClass="error" styleClass="messages" id="messages" globalOnly="true"/>
                        </span>
            
                            <div class="buttonBox">
                                <h:commandButton id="login" action="#{identity.login}" value="#{bundles.messages.home_loginAction}"/>
                            </div>
                            <div class="notes">
                                <h:link id="register" outcome="/register.xhtml" value="#{bundles.messages.home_registerAction}"/>
                            </div>
                            <div class="subnotes">
                                #{bundles.messages.home_useDemoAccount}
                                <ul>
                                    <li>shane/brisbane</li>
                                    <li>dan/laurel</li>
                                    <li>lincoln/charlotte</li>
                                    <li>jose/brazil</li>
                                </ul>
                            </div>
                        </fieldset>
                    </h:form>
                 </ui:define>
            
            </ui:composition>



            There are some other xhtml files in webapp/resources/components,


            1) in the subfolder model the are two files,


            1.1 displayAccount.xhtml


            <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                            xmlns:ui="http://java.sun.com/jsf/facelets"
                            xmlns:p="http://http://java.sun.com/jsf/composite/components/property"
                            xmlns:cc="http://java.sun.com/jsf/composite">
            
                <cc:interface>
                    <cc:attribute name="value" required="true"/>
                    <cc:attribute name="showEmail" required="false" default="false"/>
                </cc:interface>
            
                <cc:implementation>
                    <p:output label="Full name" value="#{cc.attrs.value.name}"/>
                    <p:output label="Username" value="#{cc.attrs.value.username}"/>
                    <p:output label="Email address" value="#{cc.attrs.value.email}" rendered="#{cc.attrs.showEmail}"/>
                </cc:implementation>
            
            </ui:composition>



            1.2 displayProyecto.xhtml


            <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                            xmlns:ui="http://java.sun.com/jsf/facelets"
                            xmlns:f="http://java.sun.com/jsf/core"
                            xmlns:h="http://java.sun.com/jsf/html"
                            xmlns:p="http://java.sun.com/jsf/composite/components/property"
                            xmlns:cc="http://java.sun.com/jsf/composite">
            
                <cc:interface>
                    <cc:attribute name="value" required="true"/>
                </cc:interface>
            
                <cc:implementation>
                    <p:output label="Name" value="#{cc.attrs.value.name}"/>
                    <p:output label="Class" verbatim="true">
                        <h:graphicImage value="/resources/img/#{cc.attrs.value.stars}-star.gif" style="padding-top: 4px;"/>
                    </p:output>
                </cc:implementation>
            
            </ui:composition>
            



            2) in the subfolder property the are another two files,


            2.1 input.xhtml


            <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                            xmlns:ui="http://java.sun.com/jsf/facelets"
                            xmlns:f="http://java.sun.com/jsf/core"
                            xmlns:h="http://java.sun.com/jsf/html"
                            xmlns:c="http://java.sun.com/jsp/jstl/core"
                            xmlns:cc="http://java.sun.com/jsf/composite">
            
                <cc:interface componentType="org.jboss.seam.faces.InputContainer">
                    <cc:attribute name="label" required="true"/>
                    <cc:attribute name="required" required="false"/>
                    <cc:attribute name="ajax" required="false" default="false"/>
                    <cc:attribute name="inputs" required="false" default="1"/>
                </cc:interface>
            
                <cc:implementation>
            
                    <div class="entry" id="#{cc.clientId}">
                        <h:outputLabel id="label" for="" value="#{cc.attrs.label}:"
                                       styleClass="#{cc.attrs.invalid ? 'label errors' : 'label'}">
                            <h:panelGroup styleClass="required" rendered="#{cc.attrs.required}">*</h:panelGroup>
                        </h:outputLabel>
                     <span class="#{cc.attrs.invalid ? 'input errors' : 'input'}">
                        <cc:insertChildren/>
                     </span>
                        <h:panelGroup rendered="#{cc.attrs.invalid}">
                            <c:forEach var="i" begin="1" end="#{cc.attrs.inputs}">
                                <h:message id="message#{i}" for="" styleClass="error errors"/>
                            </c:forEach>
                        </h:panelGroup>
                    </div>
            
                </cc:implementation>
            
            </ui:composition>
            



            2.2 output.xhtml


            <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                            xmlns:ui="http://java.sun.com/jsf/facelets"
                            xmlns:f="http://java.sun.com/jsf/core"
                            xmlns:h="http://java.sun.com/jsf/html"
                            xmlns:c="http://java.sun.com/jsp/jstl/core"
                            xmlns:cc="http://java.sun.com/jsf/composite">
            
                <cc:interface>
                    <cc:attribute name="label" required="true"/>
                    <cc:attribute name="value" required="false"/>
                    <cc:attribute name="verbatim" required="false" default="false"/>
                </cc:interface>
            
                <cc:implementation>
                    <div class="entry" id="#{cc.clientId}">
                        <span class="label">#{cc.attrs.label}:</span>
                     <span class="output">
                        <c:choose>
                            <c:when test="#{cc.attrs.verbatim}">
                                <cc:insertChildren/>
                            </c:when>
                            <c:otherwise>
                                <h:outputText value="#{cc.attrs.value}">
                                    <cc:insertChildren/>
                                </h:outputText>
                            </c:otherwise>
                        </c:choose>
                     </span>
                    </div>
                </cc:implementation>
            
            </ui:composition>
            


            Regards,


            Jose

            • 3. Re: com.sun.faces.application.resource.ResourceHandlerImp
              lightguard

              Honestly, I'm not sure where the problem is look at the view pages. I thought it would jump out, but it doesn't. My best advice is to get the source for Mojarra 2.1.3-b03, attach a debugger at one of the lines in the stack trace and see if you can see which component it's trying to render when it dies and go from there.

              • 4. Re: com.sun.faces.application.resource.ResourceHandlerImp
                pepelara

                I have just added this lines in the web.xml file ad it left resolved,


                    <servlet-mapping>
                        <servlet-name>Faces Servlet</servlet-name>
                        <url-pattern>/faces/*</url-pattern>
                    </servlet-mapping>
                    
                    <welcome-file-list>
                         <welcome-file>faces/index.html</welcome-file>
                    </welcome-file-list>



                and the index.html file leaves as follows,


                <meta http-equiv="Refresh" content="0;url=./faces/home.xhtml"/>



                Anyway thanks for your interestig and help.


                Jose