I'm trying to read an xlsx file with Apache Poi. Program works but when I tr

I'm trying to read an xlsx file with Apache Poi. Program works but when I try to put it in a smart service, I get an error java.lang.reflect.InvocationTargetException

after line XSSFWorkbook
File file = new File(fileName);
OPCPackage opcPackage = OPCPackage.open(file);
XSSFWorkbook myWorkbook = new XSSFWorkbook(opcPackage);

I wonder if the error would come from user's rights as the error seems to be at createDocumentPart. I'm using Appain 7 on Windows server 2008. With which account does run a smart service ? Where is it's temp folder ?

Thanks,

Olivier

ERROR com.appiancorp.process.engine.UnattendedJavaActivityRequest - An error occurred while executing activity: id=536883553, classname=com.solypse.etde.SolImportExcel
org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
          at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:62)
          at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPa...

OriginalPostID-58453

OriginalPostID-58453

  Discussion posts and replies are publicly visible

Parents
  • Oliver - i found this thread which i believe is the same question you are asking under the Excel component thread. (Note - in the future, if you are cross-posting, please indicate that so that people don't waste time helping in parallel w/o seeing all the information.)
    Based on this list of included jars, you are including at least 1 that you shouldn't be (dom4j.) I am guessing some XML transform stuff might be redundant as well. This page indicates all the packages that are already available to custom plugins and should NOT be included in jars under plugin/lib: forum.appian.com/.../Custom_Plug-in_Packages

    In fact it will likely cause errors if they are. If you need a library to compile against, put it in your lib-compile directory so that it doesn't get deployed. I'm not positive this will solve your problem, but it's good to eliminate variables.

    Another good approach is to start with the minimum amount of jars to run your code (e.g. just include the POI jars and forget the sql stuff for now), verify that it works, and keep adding. That will clarify which package is the problem.

    In general, putting together plugins using Appian Developer Edition is very quick and straightforward; but there are certain classes/jars that can cause conflicts. As Myles mentioned above, Appian Developer Training is a great resource for understanding some of the innards of Appian to make this easier.
Reply
  • Oliver - i found this thread which i believe is the same question you are asking under the Excel component thread. (Note - in the future, if you are cross-posting, please indicate that so that people don't waste time helping in parallel w/o seeing all the information.)
    Based on this list of included jars, you are including at least 1 that you shouldn't be (dom4j.) I am guessing some XML transform stuff might be redundant as well. This page indicates all the packages that are already available to custom plugins and should NOT be included in jars under plugin/lib: forum.appian.com/.../Custom_Plug-in_Packages

    In fact it will likely cause errors if they are. If you need a library to compile against, put it in your lib-compile directory so that it doesn't get deployed. I'm not positive this will solve your problem, but it's good to eliminate variables.

    Another good approach is to start with the minimum amount of jars to run your code (e.g. just include the POI jars and forget the sql stuff for now), verify that it works, and keep adding. That will clarify which package is the problem.

    In general, putting together plugins using Appian Developer Edition is very quick and straightforward; but there are certain classes/jars that can cause conflicts. As Myles mentioned above, Appian Developer Training is a great resource for understanding some of the innards of Appian to make this easier.
Children
No Data