Service Virtualization

  • 1.  Apache poi error in dynamic java execution step

    Posted Jul 17, 2018 07:14 AM

    Hi,

     

    I am using devtest 10.1 , and trying to read values from excel file. I have written a code for it and working fine in eclipse but after exporting it as jar and placing it in hotdeploy folder. I am tryinh to call the class -

     

    while exceution i am getting below error -

     

    ---------------------------------------------------------------------------
    | Message: Invocation Exception on Dynamic Call/Ctor java.lang.String readRows( int offset, int size, java.lang.String file_path )
    ----------------------------------------------------------------------------
    | Trapped Exception: org.apache.poi.ss.usermodel.Cell.getCellTypeEnum()Lorg/apache/poi/ss/usermodel/CellType;
    | Trapped Message: java.lang.NoSuchMethodError: org.apache.poi.ss.usermodel.Cell.getCellTypeEnum()Lorg/apache/poi/ss/usermodel/CellType;
    ----------------------------------------------------------------------------
    STACK TRACE
    java.lang.NoSuchMethodError: org.apache.poi.ss.usermodel.Cell.getCellTypeEnum()Lorg/apache/poi/ss/usermodel/CellType;
    at excelRead.ExcelRead.readRows(ExcelRead.java:45)
    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.itko.lisa.dynexec.Call.execute(Call.java:910)
    at com.itko.lisa.dynexec.Call.execute(Call.java:558)
    at com.itko.lisa.dynexec.CallEditor.invokeRaw(CallEditor.java:512)
    at com.itko.lisa.dynexec.CallEditor.invoke(CallEditor.java:371)
    at com.itko.lisa.dynexec.ComplexObjEditor.execute(ComplexObjEditor.java:948)
    at com.itko.lisa.dynexec.ComplexObjEditor.access$1100(ComplexObjEditor.java:48)
    at com.itko.lisa.dynexec.ComplexObjEditor$15.actionPerformed(ComplexObjEditor.java:865)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6533)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6298)
    at java.awt.Container.processEvent(Container.java:2236)
    at java.awt.Component.dispatchEventImpl(Component.java:4889)
    at java.awt.Container.dispatchEventImpl(Container.java:2294)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
    at java.awt.Container.dispatchEventImpl(Container.java:2280)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
    ============================================================================


    at com.itko.lisa.dynexec.Call.execute(Call.java:945)
    at com.itko.lisa.dynexec.Call.execute(Call.java:558)
    at com.itko.lisa.dynexec.CallEditor.invokeRaw(CallEditor.java:512)
    at com.itko.lisa.dynexec.CallEditor.invoke(CallEditor.java:371)
    at com.itko.lisa.dynexec.ComplexObjEditor.execute(ComplexObjEditor.java:948)
    at com.itko.lisa.dynexec.ComplexObjEditor.access$1100(ComplexObjEditor.java:48)
    at com.itko.lisa.dynexec.ComplexObjEditor$15.actionPerformed(ComplexObjEditor.java:865)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6533)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6298)
    at java.awt.Container.processEvent(Container.java:2236)
    at java.awt.Component.dispatchEventImpl(Component.java:4889)
    at java.awt.Container.dispatchEventImpl(Container.java:2294)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
    at java.awt.Container.dispatchEventImpl(Container.java:2280)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)



  • 2.  Re: Apache poi error in dynamic java execution step

    Posted Jul 17, 2018 10:38 AM

    Hi,

         Please try placing Apache poi jar in DevTest hotDeploy or lib folder.

    Vish



  • 3.  Re: Apache poi error in dynamic java execution step

    Posted Jul 17, 2018 12:44 PM

    DevTest 10.1, lib/shared/poi-3.14.jar contains the org.apache.poi.ss.usermodel.Cell class you are using. 

    DevTest 10.3, lib/shared/poi-3.17.jar also contains the class. 

    The problem is that in poi-3.14.jar used in DT 10.1, the Cell class does not have a getCellTypeEnum method. 

    In poi-3.17.jar (deployed with DT 10.3), the Cell class has the getCellTypeEnum method; however, it appears this method is scheduled for removal -- see below.

    @Removal(version="4.2")
    public abstract CellType getCellTypeEnum();

    I don't see the CellType class in 3.14, and it also looks as if the CellType class in 3.17 is being deprecated.

     

    Perhaps another approach is viable from a long term perspective, or perhaps, it is possible set up your own enum and use 3.14's getCellType and examine the int value returned.

    None = -1, Numeric = 0, String = 1, Formula = 2, Blank = 3, Boolean = 4, Error = 5
     



  • 4.  Re: Apache poi error in dynamic java execution step

    Posted Jul 18, 2018 07:38 AM

    Hi , 

     

    The code is working fine now. I unit tested in .tst file but when I am using using it in vsm after HTTPs listener step , it is giving below error -

     

     

    ============================================================================
    | Exception:
    ============================================================================
    | Step: excelRead.ExcelRead readRows
    ----------------------------------------------------------------------------
    | Message: Invocation Exception on Dynamic Call/Ctor java.lang.String readRows( java.lang.String offset1, java.lang.String size1, java.lang.String file_path )
    ----------------------------------------------------------------------------
    | Trapped Exception: Cannot get a text value from a numeric cell
    | Trapped Message: java.lang.IllegalStateException: Cannot get a text value from a numeric cell
    ----------------------------------------------------------------------------
    STACK TRACE
    java.lang.IllegalStateException: Cannot get a text value from a numeric cell
    at org.apache.poi.xssf.usermodel.XSSFCell.typeMismatch(XSSFCell.java:994)
    at org.apache.poi.xssf.usermodel.XSSFCell.getRichStringCellValue(XSSFCell.java:399)
    at org.apache.poi.xssf.usermodel.XSSFCell.getStringCellValue(XSSFCell.java:351)
    at excelRead.ExcelRead.readRows(ExcelRead.java:48)
    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.itko.lisa.dynexec.Call.execute(Call.java:910)
    at com.itko.lisa.dynexec.Call.execute(Call.java:558)
    at com.itko.lisa.dynexec.Call.reconstitute(Call.java:1711)
    at com.itko.lisa.dynexec.ComplexObj.reconstitute(ComplexObj.java:659)
    at com.itko.lisa.dynexec.ComplexObj.reconstitute(ComplexObj.java:630)
    at com.itko.lisa.dynexec.DynExecNode.execute(DynExecNode.java:221)
    at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1294)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1198)
    at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1183)
    at com.itko.lisa.editor.WalkThruPanel.prepAndExecNode(WalkThruPanel.java:1085)
    at com.itko.lisa.editor.WalkThruPanel.access$900(WalkThruPanel.java:72)
    at com.itko.lisa.editor.WalkThruPanel$10.doCallback(WalkThruPanel.java:992)
    at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:194)
    at java.lang.Thread.run(Thread.java:745)
    ============================================================================

     

    I am not sure why it is giving error in vsm ,I am using the same step which worked in .tst file. Also it is working fine in

    eclipse.



  • 5.  Re: Apache poi error in dynamic java execution step

    Posted Jul 18, 2018 01:00 PM

    Earlier error:| Message: Invocation Exception on Dynamic Call/Ctor java.lang.String readRows( int offset, int size, java.lang.String file_path )

    Current error:Exception on Dynamic Call/Ctor java.lang.String readRows( java.lang.String offset1, java.lang.String size1, java.lang.String file_path )

    From the above errors,I think readRows method is expecting  integer values at offset and size,but instead string values are being passed.