AnsweredAssumed Answered

Excel tag library with POI apache

Question asked by KarimD on Nov 13, 2018
Latest reply on Nov 13, 2018 by turst07

Hello,

 

I have a build a custom process that allows us to export data and send through email. The process was working fine before we migrated from 15.2 to 15.4. Below an extract of the process and the error :

<gel:script xmlns:core="jelly:core"
             xmlns:util="jelly:util"
             xmlns:x="jelly:xml"
             xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
             xmlns:sql="jelly:sql"
             xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
             xmlns:xog="http://www.niku.com/xog"
             xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
             xmlns:email="jelly:email"
             xmlns:file="jelly:com.niku.union.gel.FileTagLibrary">
 <!--Set up SQL datasources-->
 <gel:setDataSource dbId="niku"/>  
 <!-- Recup nom, prenom, mail et OBS du demandeur -->
 <sql:query var="demandeur" escapeText="0">
 SELECT usr.FIRST_NAME as f_name,
  usr.LAST_NAME as l_name,
  usr.EMAIL_ADDRESS as mail,
  exp.lodh_stda01 as start_date,
  exp.lodh_enda01 as end_date,
  datediff(month, lodh_stda01,lodh_enda01) as nbmois,
  month(lodh_stda01) as num_mois,
    isnull(***_ex.UNIT_ID,***.unit_id) as obs_unit_id,
  convert(varchar,getdate(),112) as dte_report
 FROM ODF_CA_LODH_EXEX01 exp
   INNER JOIN CMN_SEC_USERS usr
  INNER JOIN SRM_RESOURCES res
    LEFT OUTER JOIN PRJ_OBS_ASSOCIATIONS ***
    ON ***.RECORD_ID=res.ID AND ***.TABLE_NAME='SRM_RESOURCES'
  ON res.[USER_ID]=usr.ID   
   ON usr.ID=exp.created_by
    LEFT OUTER JOIN PRJ_OBS_ASSOCIATIONS ***_ex
    ON ***_ex.RECORD_ID = exp.id AND ***_ex.TABLE_NAME='lodh_exex01'
 WHERE exp.id=${gel_objectInstanceId}
 </sql:query>
 <!--Create Workbook-->
    <core:new className="org.apache.poi.hssf.usermodel.HSSFWorkbook" var="wb"/>

  <!--Create Sheet-->
  <core:invoke method="createSheet" on="${wb}" var="sheet">
    <core:arg type="java.lang.String" value="Global projects informations"/>
  </core:invoke>
  
  <!--Create Bold Style-->
   <core:invoke method="createCellStyle" on="${wb}" var="style"/>
   <core:invoke method="createFont" on="${wb}" var="font"/>
   <core:invoke method="setBoldweight" on="${font}">
    <core:arg type="java.lang.Short" value="700"/>
   </core:invoke>
   <core:invoke method="createCellStyle" on="${wb}" var="style"/>
   <core:invoke method="setFont" on="${style}">
    <core:arg type="org.apache.poi.hssf.usermodel.HSSFFont" value="${font}"/>
   </core:invoke>
  
  <!--Create ligne entête -->
   <core:invoke method="createRow" on="${sheet}" var="row1">
   <core:arg type="java.lang.Integer" value="0"/>
   </core:invoke>
   <!--Create Row1 Col1-->
   <core:invoke method="createCell" on="${row1}" var="r1c1">
    <core:arg type="java.lang.Integer" value="0"/>
   </core:invoke>
   <core:invoke method="setCellValue" on="${r1c1}">
    <core:arg type="java.lang.String" value="Employee ID"/>
   </core:invoke>
   <!--Bold Row1 Col1-->
   <core:invoke method="setCellStyle" on="${r1c1}">
    <core:arg type="org.apache.poi.hssf.usermodel.HSSFCellStyle" value="${style}"/>
   </core:invoke>

 

This is the error when I tried to do the export :

org.apache.commons.jelly.JellyTagException: null:37:52: <core:invoke> No such accessible method: setBoldweight() on object: org.apache.poi.hssf.usermodel.HSSFFont
 at org.apache.commons.jelly.tags.core.InvokeTag.doTag(InvokeTag.java:100)
 at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247)
 at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
 at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186)
 at com.niku.union.gel.tags.ScriptTag.doTag(ScriptTag.java:20)
 at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247)
 at com.niku.union.gel.GELScript.run(GELScript.java:67)
 at com.niku.union.gel.GELController.invoke(GELController.java:74)
 at com.niku.bpm.services.ExecuteCustomAction.run(ExecuteCustomAction.java:207)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoSuchMethodException: No such accessible method: setBoldweight() on object: org.apache.poi.hssf.usermodel.HSSFFont
 at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:214)
 at org.apache.commons.jelly.tags.core.InvokeTag.doTag(InvokeTag.java:97)
 ... 11 more
Root cause
java.lang.NoSuchMethodException: No such accessible method: setBoldweight() on object: org.apache.poi.hssf.usermodel.HSSFFont
 at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:214)
 at org.apache.commons.jelly.tags.core.InvokeTag.doTag(InvokeTag.java:97)
 at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247)
 at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
 at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186)
 at com.niku.union.gel.tags.ScriptTag.doTag(ScriptTag.java:20)
 at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247)
 at com.niku.union.gel.GELScript.run(GELScript.java:67)
 at com.niku.union.gel.GELController.invoke(GELController.java:74)
 at com.niku.bpm.services.ExecuteCustomAction.run(ExecuteCustomAction.java:207)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 at java.lang.Thread.run(Thread.java:748)

 

Any help or guide to resolve this issue is appreciated.

 

Thank you in advance.

Karim

Outcomes