7 Replies Latest reply on May 9, 2007 3:24 PM by Stan Silvert

    JBoss 5beta1, JSF1.2 and Netbeans Visual Web Pack

    Jason Hopkins Newbie

      Hi, I'm trying to get a net beans visual web pack created project to deploy in Jboss 5 beta 1. Initially Jboss complained that the generated managed-beans.xml was not well formed, but I couldn't see anything wrong with it according the the JSF1.2 schema:


      <?xml version="1.0" encoding="UTF-8"?>
      <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
       <managed-bean>
       <managed-bean-name>BackOfficeSession</managed-bean-name>
       <managed-bean-class>com.uk.realistic.regal.web.BackOfficeSession</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       </managed-bean>
      ...
      (all lot more of the same)
      ...
      
      </faces-config>
      


      Moving this into the main faces-config.xml and removing the reference to managed-beans.xml in web.xml fixes this. Any ideas why it thinks it isn't well formed?

      The next problem is that it will not compile any .jsp file that uses a Visual Web Pack component (Woodstock components), I get a huge number of errors far too long to publish here, but here are the interesting ones:

      org.apache.jasper.JasperException: Unable to compile class for JSP
      
      An error occurred at line: 5 in the jsp file: /Index.jsp
      Generated servlet error:
      The method setId(String) in the type UIComponentClassicTagBase is not applicable for the arguments (JspValueExpression)
      ..
      ..
      An error occurred at line: 5 in the jsp file: /Footer.jspf
      Generated servlet error:
      The method setId(String) in the type UIComponentClassicTagBase is not applicable for the arguments (JspValueExpression)
      
      
       at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
       at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:329)
       at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
       at org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
       at org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
       at org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
       at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
      ..
      ..
      ..
      An error occurred at line: 5 in the jsp file: /Footer.jspf
      Generated servlet error:
      The method setId(String) in the type UIComponentClassicTagBase is not applicable for the arguments (JspValueExpression)
      
      
       at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:418)
       at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:480)
       at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:125)
       at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:133)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:244)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
      ...
      ...
      ...
      An error occurred at line: 5 in the jsp file: /Footer.jspf
      Generated servlet error:
      The method setId(String) in the type UIComponentClassicTagBase is not applicable for the arguments (JspValueExpression)
      
      
       at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.cleanup(ViewHandlerImpl.java:559)
       at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:290)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:133)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:244)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
      


      I feel that I should be performing some additional configuration for the woodstock (visual web pack/creator 2) components, but have no idea where to start! Any suggestions/pointers would be most welcome.


        • 1. Re: JBoss 5beta1, JSF1.2 and Netbeans Visual Web Pack
          Stan Silvert Master

          The Jasper code in beta 1 had some problems with IceFaces components. This might be the same problem. I don't know of anyone who has tried it with Woodstock. You might want to try building JBoss 5 out of subversion, or waiting for the JBoss 4.2 beta which should be out very soon. Both contain the IceFaces fix.

          As for the "well-formed" problem, I don't know the answer. Maybe something really was not well-formed?

          Stan
          http://jsf.jboss.org

          • 2. Re: JBoss 5beta1, JSF1.2 and Netbeans Visual Web Pack
            Jason Hopkins Newbie

            Hi Stan,

            I didn't notice your reply as I don't think I got the notification email or it was idenitfied as spam... I notice 4.2 CR1 is out, I'll give it a try tomorrow and let you know the results.

            Thanks very much,
            Jason

            • 3. Re: JBoss 5beta1, JSF1.2 and Netbeans Visual Web Pack
              Jason Hopkins Newbie

              Hi Stan,

              I deployed my app to JBoss 4.2CR1 and the good news is the malformed error has disapeared! The bad news is I am getting the same error from the woodstock components:

              12:42:28,578 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
              org.apache.jasper.JasperException: Unable to compile class for JSP:
              
              An error occurred at line: 5 in the jsp file: /Index.jsp
              The method setId(String) in the type UIComponentClassicTagBase is not applicable for the arguments (JspValueExpression)
              2: <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmln
              s:webuijsf="http://www.sun.com/webui/webuijsf">
              3: <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
              4: <f:view>
              5: <webuijsf:page binding="#{Index.index}" id="index">
              6: <webuijsf:html binding="#{Index.html}" id="html">
              7: <webuijsf:head binding="#{Index.head}" id="head">
              8: <webuijsf:link binding="#{Index.link1}" id="link1" url="/resources/stylesheet.css"/>
              


              It's a little bit strange becuase I'm not using a jspValueExpression on the id attribute (I assume that means a #{...} expression). I checked the TLD file for the components and could find nothing untoward there. I can only assume that the version of UIComponentClassicTagBase in JBoss is not what the components are expecting. Do you know what version if the jsf-api/impl are used by 4.2?

              Any other suggestions would be most welcome.

              Regards,
              Jason

              • 4. Re: JBoss 5beta1, JSF1.2 and Netbeans Visual Web Pack
                Stan Silvert Master

                JBoss 4.2 is using JSF 1.2_03 from java.net. Have you tried the tag without setting the id attribute?

                Do you have a simple test app that I can try to reproduce the problem with?

                Stan
                http://jsf.jboss.org

                • 5. Re: JBoss 5beta1, JSF1.2 and Netbeans Visual Web Pack
                  Holger Niklas Newbie

                  I also have this problem reproduced with jboss4.2CR2 with an app which works with suns app server. The attribute id is mandatory for the tag.

                  index.jsp:

                  <%@page contentType="text/html"%>
                  <%@page pageEncoding="UTF-8"%>
                  <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
                  <%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
                  <%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
                  <%@taglib prefix="ui" uri="http://java.sun.com/blueprints/ui" %>
                  <html>
                  <head>
                  <title>AJAX FileUpload Page</title>
                  <script>
                  
                   function props(namex) {
                   var listx="";
                   var ob=dojo.byId(namex);
                   for(xx in ob) {
                   listx += xx + " = " + ob[xx] + "<br/>"
                   }
                   //document.write(listx);
                   alert(listx);
                   }
                  
                   function testRetFunction(type, data, evt){
                   // handle successful response here
                   var resultx = data.getElementsByTagName("response")[0];
                   if(resultx) {
                   alert("Customer AJAX Return Function Call" + '\n' +
                   "Message: " + resultx.getElementsByTagName("message")[0].childNodes[0].nodeValue + '\n' +
                   "Status Code: " + resultx.getElementsByTagName("status")[0].childNodes[0].nodeValue + '\n' +
                   "Raw Duration Time (milliseconds): " + resultx.getElementsByTagName("duration")[0].childNodes[0].nodeValue + '\n' +
                   "Duration Time String: " + resultx.getElementsByTagName("duration_string")[0].childNodes[0].nodeValue + '\n' +
                   "Start Date/Time: " + resultx.getElementsByTagName("start_date")[0].childNodes[0].nodeValue + '\n' +
                   "End Date/Time: " + resultx.getElementsByTagName("end_date")[0].childNodes[0].nodeValue + '\n' +
                   "Byte Size of Upload: " + resultx.getElementsByTagName("upload_size")[0].childNodes[0].nodeValue);
                   } else {
                   alert("Customer AJAX Return Function Call");
                   }
                   }
                  
                  </script>
                  </head>
                  <body>
                   <h1>AJAX FileUpload Page</h1>
                  
                   <f:view>
                  
                   <table border="1" colspacing="5" colpadding="5">
                   <tr>
                   <td>
                   <br/>FileUpload Test Section 1.
                   <br/>This section tests the custom return function with progress bar<br/>
                   <ui:fileUploadTag id="TestFileuploadForm0" retFunction="testRetFunction" retMimeType="text/xml"
                   postProcessingMethod="#{FileUploadCustomBean.postProcessingMethod}"
                   progressBarDivId="progress1x" progressBarSubmitId="submit1x" progressBarSize="40">
                   <input type="file" size="40" name="fileToUpload0" id="fileToUpload0Id"/><br/>
                   <input type="file" size="40" name="fileToUpload1" id="fileToUpload1Id"/><br/>
                   <input type="file" size="40" name="fileToUpload2" id="fileToUpload2Id"/><br/>
                   <input type="submit" id="submit1x" name="submit1x" value="Submit"/><br/>
                   <div id="progress1x"></div><br/>
                   </ui:fileUploadTag>
                   </td>
                   </tr>
                   <tr>
                   <td>
                   <br/>FileUpload Test Section 2.
                   <br/>This section tests the default scenario.<br/>
                   <ui:fileUploadTag id="TestFileuploadForm2" progressBarDivId="progress3x" progressBarSubmitId="submit3x">
                   <input type="file" size="40" name="fileToUpload5" id="fileToUpload5Id"/><br/>
                   <input type="submit" id="submit3x" name="submit3x" value="Submit"/>
                   <div id="progress3x"></div><br/>
                   </ui:fileUploadTag>
                   </td>
                   </tr>
                   </table>
                  
                   </f:view>
                   <br/><br/><br/><br/><br/><br/>
                   <hr/>
                   <center>
                   <a href="http://blueprints.dev.java.net/">Java BluePrints</a> |
                   <a href="http://sun.com">Sun Microsystems</a> © 2006 Sun Microsystems Inc. All rights reserved. Use is subject to license terms.
                   </center>
                  </body>
                  </html>
                  
                  
                  



                  web.xml:

                  <?xml version="1.0" encoding="UTF-8"?>
                  <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
                   <context-param>
                   <param-name>com.sun.faces.verifyObjects</param-name>
                   <param-value>true</param-value>
                   </context-param>
                   <context-param>
                   <param-name>com.sun.faces.validateXml</param-name>
                   <param-value>true</param-value>
                   </context-param>
                   <context-param>
                   <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                   <param-value>client</param-value>
                   </context-param>
                  
                   <servlet>
                   <display-name>FacesServlet</display-name>
                   <servlet-name>FacesServlet</servlet-name>
                   <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                   <load-on-startup>1</load-on-startup>
                   </servlet>
                   <servlet-mapping>
                   <servlet-name>FacesServlet</servlet-name>
                   <url-pattern>/faces/*</url-pattern>
                   </servlet-mapping>
                   <session-config>
                   <session-timeout>
                   30
                   </session-timeout>
                   </session-config>
                   <welcome-file-list>
                   <welcome-file>index.html</welcome-file>
                   </welcome-file-list>
                  </web-app>
                  
                  


                  faces-config.xml:


                  <?xml version='1.0' encoding='UTF-8'?>
                  
                  <!-- Copyright 2005 Sun Microsystems, Inc. All rights reserved. You may not modify, use, reproduce, or distribute this software except in compliance with the terms of the License at:
                   http://developer.sun.com/berkeley_license.html
                   $Id: faces-config.xml,v 1.1 2006/06/20 00:08:52 inder Exp $ -->
                  
                  <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
                   version="1.2">
                  
                   <managed-bean>
                   <managed-bean-name>FileUploadCustomBean</managed-bean-name>
                   <managed-bean-class>com.sun.javaee.blueprints.fileupload.FileUploadCustomBean</managed-bean-class>
                   <managed-bean-scope>session</managed-bean-scope>
                   </managed-bean>
                  
                  </faces-config>
                  

                  The error message:
                  org.apache.jasper.JasperException: Unable to compile class for JSP:
                  
                  An error occurred at line: 51 in the jsp file: /index.jsp
                  The method setId(String) in the type UIComponentClassicTagBase is not applicable for the arguments (JspValueExpression)
                  48: <td>
                  49: <br/>FileUpload Test Section 1.
                  50: <br/>This section tests the custom return function with progress bar<br/>
                  51: <ui:fileUploadTag id="TestFileuploadForm0" retFunction="testRetFunction" retMimeType="text/xml"
                  52: postProcessingMethod="#{FileUploadCustomBean.postProcessingMethod}"
                  53: progressBarDivId="progress1x" progressBarSubmitId="submit1x" progressBarSize="40">
                  54: <input type="file" size="40" name="fileToUpload0" id="fileToUpload0Id"/><br/>
                  
                  
                  An error occurred at line: 66 in the jsp file: /index.jsp
                  The method setId(String) in the type UIComponentClassicTagBase is not applicable for the arguments (JspValueExpression)
                  63: <td>
                  64: <br/>FileUpload Test Section 2.
                  65: <br/>This section tests the default scenario.<br/>
                  66: <ui:fileUploadTag id="TestFileuploadForm2" progressBarDivId="progress3x" progressBarSubmitId="submit3x">
                  67: <input type="file" size="40" name="fileToUpload5" id="fileToUpload5Id"/><br/>
                  68: <input type="submit" id="submit3x" name="submit3x" value="Submit"/>
                  69: <div id="progress3x"></div><br/>
                  
                  


                  Please let me know if you have a solution.

                  Thanks in advance

                  • 6. Re: JBoss 5beta1, JSF1.2 and Netbeans Visual Web Pack
                    Stan Silvert Master

                    Can you send me a simple test app that reproduces the problem? I'd like to see this problem for myself and debug it from here.

                    Thanks,

                    Stan

                    • 7. Re: JBoss 5beta1, JSF1.2 and Netbeans Visual Web Pack
                      Stan Silvert Master

                      There is a problem in the TLD for the fileUploadTag. If you look in ui.tld for that tag, the id is defined like this:

                      <attribute>
                       <name>id</name>
                       <required>true</required>
                       <rtexprvalue>false</rtexprvalue>
                       <deferred-value>
                       <type>java.lang.String</type>
                       </deferred-value>
                       <description>
                       The required attribute is used to associate the components related functions.
                       </description>
                       </attribute>



                      But FileUploadTag.java extends javax.faces.webapp.UIComponentELTag, which is designed for JSF 1.2. For components that extend this class, the id attribute must be defined like this:

                      <attribute>
                       <name>id</name>
                       <required>
                       false
                       </required>
                       <rtexprvalue>
                       true
                       </rtexprvalue>
                       <description>
                       The required attribute is used to associate the components related functions.
                       </description>
                       </attribute>


                      See Section 9.3 of the JSF 1.2 spec.

                      Anyhow, if you change the TLD to what I have above, it will work.

                      Stan
                      http://jsf.jboss.com