AnsweredAssumed Answered

Error while calling webscript from dashlet?

Question asked by dynamolalit on Jun 24, 2010
Latest reply on Jul 5, 2010 by bergerrc
Hi,

I have created a dashlet which will show top n content uploader.

Here is my dashlet  jsp for the same as below .

kmContributions.jsp :


<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>

<%@ page import="com.xxxx.alfresco.km.webscripts.WebScriptInvoker"%>
<%@ page import="com.xxxx.alfresco.km.webscripts.WebScriptCall"%>
<%@ page import="java.lang.Integer"%>


<f:verbatim>
<FORM id="1" NAME="myform" ACTION="/jsp/extension/dashlets/kmContributions.jsp" METHOD="POST">
    <p>
   Number of KM Contributors :
   <select id="2" name="number">
     <option value="Select">Select</option>
     <option value="5">5</option>
     <option value="10">10</option>
     <option value="15">15</option>
     <option value="20">20</option>
     <option value="25">25</option>
   </select>
   <p>
   Location for Search :
   <select id="3" name="location">
   <option value="Select">Select</option>
     <option value="all">All</option>
     <option value="xx">xx</option>
    <option value="xx2">xx2</option>
   </select>
   <p>
   <INPUT id="4" TYPE="submit" NAME="Search" Value="Search" ">

</FORM>
</f:verbatim>



<%! String number = null; %>
<%! String location = null; %>
<%! String link = null; %>

<%
   number = (String)request.getParameter("number"); 
   System.out.println("Top KM Contributors in kmContributions.jsp : "+ number);
    location = (String)request.getParameter("location"); 
   System.out.println("Location in kmContributions.jsp "+location);
   if(number == null || location == null || number.equalsIgnoreCase("Select") || location.equalsIgnoreCase("Select")){
      //Do Nothing
      System.out.println("Invalid Value");
   }else{
      // Call Webscript
      System.out.println("valid Value");
       link = "/wcs/com/xxxx/km/gettopcontributors?number="+number+"&location="+location;
      System.out.println("Web Script URL Value : "+link);
      %>
      <r:webScript scriptUrl="<%=link%>" />
   <%}
%>

I am calling a java backed web script  from this dashlet which returns me all the top n contributors in  html as below .


   res.setContentType("text/html ");
   finalOutput +="<f:verbatim>";
   finalOutput += "<b>Top "+ num +" KM Contributors in xxxx KM Space for " +location+" location(s) are :</b> <br><br>";   
   finalOutput +=    "<html>"+
   "<body>"+
   "<table border=1>"+
   "<tr>"+
   "<th>"+
   "User Id"+
   "</th>"+
   "<th>"+
   "Total Content "+
   "</th>"+
   "</tr>";
   for(int k = 0; k < cnt ; k++){         
   finalOutput += "<tr><td align=left>";
   finalOutput += finalKeyList.get(k).toString();
   finalOutput +="</td><td align=left>";
   finalOutput += finalValueList.get(k).toString();
   finalOutput += "</td></tr>";
   }
   finalOutput += "</table></body></html>";
   finalOutput +="</f:verbatim>";
   logger.debug("finalOutput : "+finalOutput);
   res.getWriter().write(finalOutput);

But i am getting error on my browser as below but no error on server console. :?



HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.faces.FacesException: java.lang.IllegalStateException: Client-id : _idJsp19 is duplicated in the faces tree. Component : dashboard:dash-body:dashlet-3-view:_idJsp19, path: {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/dashboards/container.jsp][Class: javax.faces.component.html.HtmlForm,Id: dashboard][Class: javax.faces.component.UINamingContainer,Id: dash-body][Class: javax.faces.component.html.HtmlPanelGrid,Id: _idJsp12][Class: org.alfresco.web.ui.common.component.UIPanel,Id: dashlet-3][Class: javax.faces.component.UINamingContainer,Id: dashlet-3-view][Class: org.alfresco.web.ui.common.component.data.UIRichList,Id: pooled-tasks-list][Class: org.alfresco.web.ui.common.component.data.UIColumn,Id: col1][Class: org.alfresco.web.ui.common.component.UIActionLink,Id: col1-act2][Class: javax.faces.component.UIParameter,Id: _idJsp19]}
   org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:425)
   org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
   org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
   org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
   javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
   org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:110)
   sun.reflect.GeneratedMethodAccessor498.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   java.lang.reflect.Method.invoke(Method.java:597)
   org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   $Proxy210.doFilter(Unknown Source)
   org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
   org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:74)
   sun.reflect.GeneratedMethodAccessor498.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   java.lang.reflect.Method.invoke(Method.java:597)
   org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   $Proxy210.doFilter(Unknown Source)
   org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)

root cause

org.apache.jasper.JasperException: java.lang.IllegalStateException: Client-id : _idJsp19 is duplicated in the faces tree. Component : dashboard:dash-body:dashlet-3-view:_idJsp19, path: {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/dashboards/container.jsp][Class: javax.faces.component.html.HtmlForm,Id: dashboard][Class: javax.faces.component.UINamingContainer,Id: dash-body][Class: javax.faces.component.html.HtmlPanelGrid,Id: _idJsp12][Class: org.alfresco.web.ui.common.component.UIPanel,Id: dashlet-3][Class: javax.faces.component.UINamingContainer,Id: dashlet-3-view][Class: org.alfresco.web.ui.common.component.data.UIRichList,Id: pooled-tasks-list][Class: org.alfresco.web.ui.common.component.data.UIColumn,Id: col1][Class: org.alfresco.web.ui.common.component.UIActionLink,Id: col1-act2][Class: javax.faces.component.UIParameter,Id: _idJsp19]}
   org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:410)
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
   org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
   org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
   org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
   javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
   org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:110)
   sun.reflect.GeneratedMethodAccessor498.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   java.lang.reflect.Method.invoke(Method.java:597)
   org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   $Proxy210.doFilter(Unknown Source)
   org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
   org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:74)
   sun.reflect.GeneratedMethodAccessor498.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   java.lang.reflect.Method.invoke(Method.java:597)
   org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   $Proxy210.doFilter(Unknown Source)
   org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)

root cause

java.lang.IllegalStateException: Client-id : _idJsp19 is duplicated in the faces tree. Component : dashboard:dash-body:dashlet-3-view:_idJsp19, path: {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/dashboards/container.jsp][Class: javax.faces.component.html.HtmlForm,Id: dashboard][Class: javax.faces.component.UINamingContainer,Id: dash-body][Class: javax.faces.component.html.HtmlPanelGrid,Id: _idJsp12][Class: org.alfresco.web.ui.common.component.UIPanel,Id: dashlet-3][Class: javax.faces.component.UINamingContainer,Id: dashlet-3-view][Class: org.alfresco.web.ui.common.component.data.UIRichList,Id: pooled-tasks-list][Class: org.alfresco.web.ui.common.component.data.UIColumn,Id: col1][Class: org.alfresco.web.ui.common.component.UIActionLink,Id: col1-act2][Class: javax.faces.component.UIParameter,Id: _idJsp19]}
   org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(JspStateManagerImpl.java:329)
   org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(JspStateManagerImpl.java:341)
   org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(JspStateManagerImpl.java:341)
   org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(JspStateManagerImpl.java:341)
   org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(JspStateManagerImpl.java:338)
   org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(JspStateManagerImpl.java:341)
   org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(JspStateManagerImpl.java:341)
   org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(JspStateManagerImpl.java:338)
   org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(JspStateManagerImpl.java:338)
   org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(JspStateManagerImpl.java:341)
   org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerializedView(JspStateManagerImpl.java:286)
   org.apache.myfaces.taglib.core.ViewTag.doAfterBody(ViewTag.java:125)
   org.apache.jsp.jsp.dashboards.container_jsp._jspService(container_jsp.java:540)
   org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
   org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
   org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
   org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
   javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
   org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:110)
   sun.reflect.GeneratedMethodAccessor498.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   java.lang.reflect.Method.invoke(Method.java:597)
   org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   $Proxy210.doFilter(Unknown Source)
   org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
   org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:74)
   sun.reflect.GeneratedMethodAccessor498.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   java.lang.reflect.Method.invoke(Method.java:597)
   org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   $Proxy210.doFilter(Unknown Source)
   org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)


I am wondering what is going wrong here.Is it a redirection issue or JSF issue or anything else. :?:

Any help will be highly appreciated.

Outcomes