0 Replies Latest reply on Jun 30, 2008 10:16 AM by Pavel Perepelitsa

    a4j:commandButton - Error in conversion Java Object to JS

    Pavel Perepelitsa Newbie

      Sorry for double post http://www.jboss.com/index.html?module=bb&op=viewtopic&t=138095,
      but there nobody answer me

      I have button on my form:

      <a4j:commandButton actionListener="#{processDataChangeFioV01.addParagraph}" value="Add Paragraph" reRender="masterFormId:paragraphs">
       <f:param name="destination" value="#{document.content.body}"/>
      </a4j:commandButton>

      During rendering page with this button, i'm getting exception:
      javax.faces.FacesException: Error in conversion Java Object to JavaScript
       at org.ajax4jsf.javascript.ScriptUtils.toScript(ScriptUtils.java:133)
       at org.ajax4jsf.javascript.ScriptUtils.toScript(ScriptUtils.java:98)
       at org.ajax4jsf.javascript.ScriptUtils.toScript(ScriptUtils.java:98)
       at org.ajax4jsf.javascript.JSFunction.appendScript(JSFunction.java:84)
       at org.ajax4jsf.renderkit.AjaxRendererUtils.buildOnEvent(AjaxRendererUtils.java:183)
       at org.ajax4jsf.renderkit.AjaxRendererUtils.buildOnClick(AjaxRendererUtils.java:140)
       at org.ajax4jsf.renderkit.AjaxCommandRendererBase.getOnClick(AjaxCommandRendererBase.java:63)
       at org.ajax4jsf.renderkit.html.CommandButtonRenderer.doEncodeEnd(CommandButtonRenderer.java:114)
       at org.ajax4jsf.renderkit.html.CommandButtonRenderer.doEncodeEnd(CommandButtonRenderer.java:161)
       at org.ajax4jsf.renderkit.RendererBase.encodeEnd(RendererBase.java:135)
       at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
       at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:286)
       at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
       at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:199)
       at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:194)
       at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:121)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
       at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
       at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290
      )
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
       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:432)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       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:262)
       at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
       at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:366)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
       at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.faces.FacesException: Error in conversion Java Object to JavaScript
       at org.ajax4jsf.javascript.ScriptUtils.toScript(ScriptUtils.java:133)
       at org.ajax4jsf.javascript.ScriptUtils.toScript(ScriptUtils.java:128)
       ... 65 more
      Caused by: java.lang.NoSuchMethodException: Property 'embedable' has no getter method
       at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1127)
       at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:686)
       at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:715)
       at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:290)
       at org.ajax4jsf.javascript.ScriptUtils.toScript(ScriptUtils.java:128)
       ... 66 more
      

      As I understand the problem with serializing my #{document.content.body} object to JavaScript.
      java.lang.NoSuchMethodException: Property 'embedable' has no getter method

      this points that serializer cann't invoke getEmbedable() method for Body object, but this property is Boolean, so it has isEmbedable() method instead of getEmbedable().
      So, I think the problem in A4J core: it cann't serialize is-methods.

      P.S. If I change <a4j:commandButton/> to <h:commandButton/>
      or passing List object as parameter, exception doesn't occure