Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
13 replies
Subscribers
5 subscribers
Views
17444 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Plug-Ins
I'm trying to read an xlsx file with Apache Poi. Program works but when I tr
olivierl
over 12 years ago
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
0
olivierl
over 12 years ago
...rt.java:403)
at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:155)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:186)
at com.solypse.etde.SolImportExcel.ReadFile(SolImportExcel.java:156)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
olivierl
over 12 years ago
or could it be possible that some required jar aren't generated with the plugin ?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
olivierl
over 12 years ago
Hum, I didn't copy poi jars in the meta-inf... I come back if it's not that ;-)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
olivierl
over 12 years ago
Wuestion still open, I'm using Eclipse, so according to
forum.appian.com/.../Appian_Plug-in_Creator_for_Eclipse
I just have to put the jar files in lib, that's what I have done and META-INF is in the jar. poi3.9 comes with a main folder that I put in the lib folder that could not be a problem ?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Myles Weber
Appian Employee
over 12 years ago
www.appian.com/.../bpm-developer301.jsp
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
peterf
over 12 years ago
Is "filename" the internal file name of an Appian document? Have you tried using a FileInputStream and passing it to WorkbookFactory.create to obtain the WorkBook?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
olivierl
over 12 years ago
Hi Peter,
That's kind of you to try to help me. I have been struggling with that for all day now.
I tried your solution but this generates other errors. I don't understand as this soft works when it's outside Appian.
I declared thos jar
dom4j-1.6.1.jar
lingpipe-4.1.0.jar
mysql-connector-java-5.1.22-bin.jar
poi-3.9-20121203.jar
poi-excelant-3.9-20121203.jar
poi-ooxml-3.9-20121203.jar
poi-ooxml-schemas-3.9-20121203.jar
stax-api-1.0.1.jar
xmlbeans-2.3.0.jar
And my test code is as follow :
fileName="C:\\\\1_Solypse\\\ est.xlsx";
File file = new File(fileName);
log("fichier " + fileName );
OPCPackage opcPackage;
try {
opcPackage = OPCPackage.open(file);
log("excel 1 ");
Workbook myWorkbook = WorkbookFactory.create(opcPackage);
// XSSFWorkbook myWorkbook = new XSSFWorkbook(opcPackage);
log("excel 2 ");
XSSFSheet mySheet = (XSSFSheet) myWorkbook.getSheetAt(0);
log("excel 3 ");
With your solution or mine, problems occurs each time after log("excel 1")
2013-02-19 20:00:08,306 [WorkManager(2)-2] ERROR com.appiancorp.process.engine.UnattendedJavaActivityRequest - An error occurred while executing activity: id=536883678, 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(POIXMLDocumentPart.java:403)
at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:155)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:186)
at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:55)
at com.solypse.etde.SolImportExcel.ReadFile(SolImportExcel.java:164)
at com.solypse.etde.SolImportExcel.run(SolImportExcel.java:75)
at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:100)
at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:97)
at com.appiancorp.common.ContextClassLoaderSwitcher.runInContext(ContextClassLoaderSwitcher.java:25)
at com.appiancorp.process.runtime.framework.DefaultActivityExecutor.execute(DefaultActivityExecutor.java:97)
at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:91)
at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:61)
at com.appiancorp.mdb.UnattendedRequestHandlerBean.onMessage(UnattendedRequestHandlerBean.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)
at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69)
at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:73)
at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:59)
at sun.reflect.GeneratedMethodAccessor1118.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72)
at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_859840937.invoke(InvocationContextInterceptor_z_fillMet
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
olivierl
over 12 years ago
I tried to add main to run program outside Appian. It runs in Eclipse but when launched as smart, the following code exist with "error 0 Can't read content types part !".and no message in appian-server.log. Of course, I tried to open the Excel file from another pc, tried another file, same problem.
Thanks for any help, I'm struggling with this for two days now.
fileName="C:\\\\1_Solypse\\\ est2.xlsx";
File file = new File(fileName);
OPCPackage opcPackage;
XSSFWorkbook myWorkbook = null;
try{
opcPackage = OPCPackage.open(file);
myWorkbook=new XSSFWorkbook(opcPackage);
} catch (Exception e){
log("error 0 " + e.Message());
}
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
elizabeth.epstein
over 12 years ago
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.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
olivierl
over 12 years ago
Thanks for this answer. I stopped to post on tempo as I understood it was not the best place to ask this sort of question. That's why I went to your smart service that seemed closest to my needs.
Yes, some training is always good but there are no session so far in France.
I'm going to try again your suggestions I hope it will finally work because I'm adding up and down jars for past 3 days. Thanks very much for your time !
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
>