I am trying to generate an excel file using apache POI API and I have included the below jar files in a java project and executed the service and the excel file was successfully created.
But, When I include the same code in webMethods java service, it gives the below error. I searched online and it seems such errors as below will occur when 2 versions of the same .jar files are in the classpath and will conflict.
I searched in my SAG Installation Directory for any conflicting poi jar files and it seems it is referred at many other places as well(please refer attached file for details) and I am not sure how I can make my program to use only the .jar files placed inside my package/code/jars directory.
Note: Debugging the java service does not result in any error and the excel file is generated successfully, but running it gives the above error.
was the package reloaded after placing the Jar-Files into code/jars?
Can you provide some more lines from Server-Log, as the InvocationTargetException seems to be incomplete for me?
You can check the IS Classpath in IS Admin UI in the WmRoot package by opening the WmRoot/about.dsp page
java.lang.NoSuchMethodError: org.apache.poi.xssf.streaming.SXSSFWorkbook.getSheetAt(I)Lorg/apache/poi/xssf/streaming/SXSSFSheet;
at LargeExcelProcessing.java.documentListToExcel(java.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:404)
at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:645)
at com.wm.ps.serviceMock.ServiceInterceptor.process(ServiceInterceptor.java:360)
at com.wm.app.b2b.server.util.tspace.ReservationProcessor.process(ReservationProcessor.java:39)
at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:53)
at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:243)
at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
at com.wm.app.b2b.server.invoke.PipelineProcessor.process(PipelineProcessor.java:171)
at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:299)
at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:34)
at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:377)
at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:544)
at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:382)
at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:234)
at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:215)
at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:257)
at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:520)
at com.wm.lang.flow.FlowState.step(FlowState.java:389)
at com.wm.lang.flow.FlowState.invoke(FlowState.java:360)
at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcI…
If we assume there is something wrong in the jars or code, then how is it that debugging the same java service with the same jars not throwing any error.
Apparently your IS has multiple copies of Apache-POI jars scattered everywhere in the instance. Please check at the classpath of the about page of IS Admin UI and see if at the IS common library folder there is already similar files being loaded into memory. That might be the reason why it confuses the JVM and resolve to the wrong jar file.
When developing in Designer, the issue won’t be there simply because the said jar file is the only jar file existed in the Designer built classpath hence will not have that issue.
Can you check manifest.v3 in your package containing this line?
Yes, I suspected the same and hence I removed the below 2 jar files manually(from the mentioned jars shared earlier) to see if the issue resolves but no luck there.
I should have mentioned this probably, that ‘LargeExcelProcessing’ is the package I am working on and hence I have placed the .jar files inside the package.
I am suspecting something conflicting from the common runtime, but I checked in the about page and did not see anything related to poi jars on the classpath but still only debug works but running the service fails.
Deleted the poi .jars from the Integration Server/lib folder and deleted the package which was giving error and restarted the IS and then freshly created a new package and kept the relevant jars inside the jars folder of the package and the error is no longer existing now.