Facing issue in smart service: a!exportDataStoreEntityToExcel()

Even when used in Process Model and also from Interface, it is throwing the error "An error occurred when attempting to write the document _name & now(). Please contact your system administrator for additional details. (APNX-1-4505-056)"

  Discussion posts and replies are publicly visible

  • Are you able to post the code from the interface here? That'll help the community to have some insights into what's happening.

  • a!sideBySideItem(

                item: a!richTextDisplayField(

                  value: a!richTextItem(

                    text: "Export to Excel",

                    link: a!dynamicLink(

                      saveInto: {

                        a!exportDataStoreEntityToExcel(

                          entity: cons!CONS_TABLE,

                          filters: a!queryLogicalExpression(

                            operator: "AND",

                            filters: {

                              a!queryFilter(

                                field: "keyword",

                                operator: "=",

                                value: ri!keywordValue,

                                applyWhen: if(

                                  isnull(

                                    ri!keywordValue

                                  ),

                                  false(),

                                  true()

                                )

                              )

                            }

                          ),

                          documentName: "Document_Name" & now(),

                          saveInFolder: cons!TEST_DOC_FOLDER,

                          includeHeader: true,

                          onSuccess: a!save(

                            local!exportDocId,

                            fv!newDocument

                          ),

     

                        )

                      },

     

                    ),

                    color: "ACCENT"

                  ),

                  align: "LEFT"

                )

              )

  • This appears to work for me (I took your code, replaced your specific local! variables, rule inputs and constants with my own and it seems to be fine).

    Have you checked that you the necessary security rights for the User you're testing this with to access the target folder? (If that's not the issue, do you have access to the Appian Logs? You may find some more detail here about the nature of the error)

  • hi,

    We have the same problem.
    In our case, the error occurs in the PRO environment but it works in test.
    Attached log trace.
    
    Could you fix it?

    251214260 [Appian Work Item - 78726 - execution02 : UnattendedJavaActivityRequest] ERROR com.appiancorp.process.engine.UnattendedJavaActivityRequest - An error occurred while executing activity: id=537648979, classname=com.appiancorp.process.runtime.activities.DataExportEntityExcelSmartService2
    com.appiancorp.suiteapi.process.exceptions.SmartServiceException: An error occurred when attempting to write the document Tipos de petición para modificar 01_12_2020 14_34 CET. Please contact your system administrator for additional detils.
    at com.appiancorp.dataexport.ExcelDocumentCreator.createOrCopyDocumentAndExportNewData(ExcelDocumentCreator.java:296)
    at com.appiancorp.dataexport.DocumentCreator.exportDocument(DocumentCreator.java:260)
    at com.appiancorp.dataexport.DataExportCore.run(DataExportCore.java:96)
    at com.appiancorp.process.runtime.activities.DataExportEntityExcelSmartService2.run(DataExportEntityExcelSmartService2.java:65)
    at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:129)
    at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:125)
    at com.appiancorp.common.ContextClassLoaderSwitcher.runInContext(ContextClassLoaderSwitcher.java:25)
    at com.appiancorp.process.runtime.framework.DefaultActivityExecutor.execute(DefaultActivityExecutor.java:125)
    at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:83)
    at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute0(UnattendedJavaActivityRequest.java:55)
    at com.appiancorp.process.engine.ContinuationRequest.executeOuter(ContinuationRequest.java:71)
    at com.appiancorp.process.engine.ContinuationRequest.execute(ContinuationRequest.java:100)
    at com.appiancorp.process.workpoller.UnattendedRequestHandlerBean.onMessage(UnattendedRequestHandlerBean.java:36)
    at com.appiancorp.process.workpoller.WorkItem.run(WorkItem.java:84)
    at org.springframework.jca.work.SimpleTaskWorkManager$DelegatingWorkAdapter.run(SimpleTaskWorkManager.java:239)
    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.NullPointerException
    at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)
    at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:219)
    at sun.awt.FontConfiguration.init(FontConfiguration.java:107)
    at sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:774)
    at sun.font.SunFontManager$2.run(SunFontManager.java:431)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.font.SunFontManager.<init>(SunFontManager.java:376)
    at sun.awt.FcFontManager.<init>(FcFontManager.java:35)
    at sun.awt.X11FontManager.<init>(X11FontManager.java:57)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:83)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
    at java.awt.Font.getFont2D(Font.java:491)
    at java.awt.Font.canDisplayUpTo(Font.java:2064)
    at java.awt.font.TextLayout.singleFont(TextLayout.java:470)
    at java.awt.font.TextLayout.<init>(TextLayout.java:531)
    at org.apache.poi.ss.util.SheetUtil.getDefaultCharWidth(SheetUtil.java:273)
    at org.apache.poi.xssf.streaming.AutoSizeColumnTracker.<init>(AutoSizeColumnTracker.java:117)
    at org.apache.poi.xssf.streaming.SXSSFSheet.<init>(SXSSFSheet.java:82)
    at org.apache.poi.xssf.streaming.SXSSFWorkbook.createAndRegisterSXSSFSheet(SXSSFWorkbook.java:684)
    at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:705)
    at com.appiancorp.dataexport.ExcelDocumentCreator.addSheet(ExcelDocumentCreator.java:360)
    at com.appiancorp.dataexport.ExcelDocumentCreator.addSheetOrCopyExisting(ExcelDocumentCreator.java:305)
    at com.appiancorp.dataexport.ExcelDocumentCreator.createOrCopyDocumentAndExportNewData(ExcelDocumentCreator.java:291)
    ... 17 more
  • Hi!,

    We have the same problem. In our case, the error occurs in the PRO environment but it works in test. Attached log trace. Could you fix it?

    251214260 [Appian Work Item - 78726 - execution02 : UnattendedJavaActivityRequest] ERROR com.appiancorp.process.engine.UnattendedJavaActivityRequest - An error occurred while executing activity: id=537648979, classname=com.appiancorp.process.runtime.activities.DataExportEntityExcelSmartService2
    com.appiancorp.suiteapi.process.exceptions.SmartServiceException: An error occurred when attempting to write the document Tipos de petición para modificar 01_12_2020 14_34 CET. Please contact your system administrator for additional detils.
    at com.appiancorp.dataexport.ExcelDocumentCreator.createOrCopyDocumentAndExportNewData(ExcelDocumentCreator.java:296)
    at com.appiancorp.dataexport.DocumentCreator.exportDocument(DocumentCreator.java:260)
    at com.appiancorp.dataexport.DataExportCore.run(DataExportCore.java:96)
    at com.appiancorp.process.runtime.activities.DataExportEntityExcelSmartService2.run(DataExportEntityExcelSmartService2.java:65)
    at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:129)
    at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:125)
    at com.appiancorp.common.ContextClassLoaderSwitcher.runInContext(ContextClassLoaderSwitcher.java:25)
    at com.appiancorp.process.runtime.framework.DefaultActivityExecutor.execute(DefaultActivityExecutor.java:125)
    at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:83)
    at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute0(UnattendedJavaActivityRequest.java:55)
    at com.appiancorp.process.engine.ContinuationRequest.executeOuter(ContinuationRequest.java:71)
    at com.appiancorp.process.engine.ContinuationRequest.execute(ContinuationRequest.java:100)
    at com.appiancorp.process.workpoller.UnattendedRequestHandlerBean.onMessage(UnattendedRequestHandlerBean.java:36)
    at com.appiancorp.process.workpoller.WorkItem.run(WorkItem.java:84)
    at org.springframework.jca.work.SimpleTaskWorkManager$DelegatingWorkAdapter.run(SimpleTaskWorkManager.java:239)
    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.NullPointerException
    at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)
    at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:219)
    at sun.awt.FontConfiguration.init(FontConfiguration.java:107)
    at sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:774)
    at sun.font.SunFontManager$2.run(SunFontManager.java:431)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.font.SunFontManager.<init>(SunFontManager.java:376)
    at sun.awt.FcFontManager.<init>(FcFontManager.java:35)
    at sun.awt.X11FontManager.<init>(X11FontManager.java:57)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:83)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
    at java.awt.Font.getFont2D(Font.java:491)
    at java.awt.Font.canDisplayUpTo(Font.java:2064)
    at java.awt.font.TextLayout.singleFont(TextLayout.java:470)
    at java.awt.font.TextLayout.<init>(TextLayout.java:531)
    at org.apache.poi.ss.util.SheetUtil.getDefaultCharWidth(SheetUtil.java:273)
    at org.apache.poi.xssf.streaming.AutoSizeColumnTracker.<init>(AutoSizeColumnTracker.java:117)
    at org.apache.poi.xssf.streaming.SXSSFSheet.<init>(SXSSFSheet.java:82)
    at org.apache.poi.xssf.streaming.SXSSFWorkbook.createAndRegisterSXSSFSheet(SXSSFWorkbook.java:684)
    at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:705)
    at com.appiancorp.dataexport.ExcelDocumentCreator.addSheet(ExcelDocumentCreator.java:360)
    at com.appiancorp.dataexport.ExcelDocumentCreator.addSheetOrCopyExisting(ExcelDocumentCreator.java:305)
    at com.appiancorp.dataexport.ExcelDocumentCreator.createOrCopyDocumentAndExportNewData(ExcelDocumentCreator.java:291)
    ... 17 more

  • Hi!, 

    we have the same problem. 

    In our case, the error occurs in the PRO enviroment but it works in test. 

    Attached part of the log trace

    Could you fix it?

    Thanks!


    251214260 [Appian Work Item - 78726 - execution02 : UnattendedJavaActivityRequest] ERROR com.appiancorp.process.engine.UnattendedJavaActivityRequest - An error occurred while executing activity: id=537648979, classname=com.appiancorp.process.runtime.activities.DataExportEntityExcelSmartService2
    com.appiancorp.suiteapi.process.exceptions.SmartServiceException: An error occurred when attempting to write the document Tipos de petición para modificar 01_12_2020 14_34 CET. Please contact your system administrator for additional detils.
    at com.appiancorp.dataexport.ExcelDocumentCreator.createOrCopyDocumentAndExportNewData(ExcelDocumentCreator.java:296)
  • Hi,

    I have the same issue with my application, but found it using the smart service instead of the function itself. Error logs is similar.
    It works perfectly fine in our dev env, but with that error in test.

    Have you found any solution / lead to solve this problem ?

    Thanks in advance,

  • 0
    Certified Senior Developer
    in reply to Matthias Kapfer

    Hey ,


    I'm having the same issue when using the smart service node in the process model and the function in an interface. Have you been able to find a solution to this yet?

    Thanks!

  • Hi

    Following my architect's advices, it looks like the problem came from an "issue" in the system setup. Indeed, it appears that to work fine, the exportDataStoreEntityToExcel method need some specific fonts.

    The solution (not fully validated yet) would be to run the following unix command:

    apt-get install fontconfig gnu-free-fonts

    Once the font installed, you'll need to restart the tomcat server.

    Please let me know if everything is fixed thanks to that,

    Best,

  • 0
    Certified Senior Developer
    in reply to Matthias Kapfer

    Thanks a lot for this suggestion. I will try this out and let you know how it goes.

    Regards,