soatestcli unable to execute scripts having java code.

rahul157rahul157 Posts: 29

I am trying to run soaest scripts using soatestcli but ending up with lots of java code error saying "class not found."
as I am using localsettings in this case do i need to make any changes so that my classfolder should get loaded along with scripts when run by soatestcli.

Comments

  • Ireneusz SzmigielIreneusz Szmigiel Posts: 135 ✭✭
    edited August 2017

    rahul157

    could you post here the line from localsettings file used to define CLASSPATH?
    Do you have all required jars/classes in location from localsettings?
    If you publish more details like screenshots, we may be able to help you faster.
    Usually if you have the same workspace used in GUI and CLI then you can execute the same test without problem.
    If you are using the same workspace on different machine you have to remember about keeping required jars/classes in the same location as defined in Preferences>System Properties .
    You can define location of required jars/classes by using localsetting variable:
    system.properties.classpath=[path1];[path2];[path3]

  • benken_parasoftbenken_parasoft Posts: 399 ✭✭✭
    edited August 2017

    You can also create a project in your workspace named "TestAssets" then create a child directory named "system_jars". SOAtest will automatically search for every jar file under TestAssets/system_jars/ then automatically add those to the classpath used for running java code and scripts. Some users find this easier than updating their localsettings file with system.properties.classpath. However, system.properties.classpath is nice because this gives you the flexibility to keep your jars wherever you want and just refer to each jar file by path. Please be aware that this is a java properties file which means that backslash is used as an escape character. Here is the example from the SOAtest User's Guide:

    system.properties.classpath=C\:\\myjars\\myLib1.jar;C\:\\myjars\\myLib2.jar
    

    Personally, I like splitting the property across multiple lines which you can do by ending a line with a backslash:

    system.properties.classpath=C\:\\myjars\\myLib1.jar;\
    C\:\\myjars\\myLib2.jar;\
    C\:\\myjars\\myLib3.jar;\
    C\:\\myjars\\myLib4.jar
    
  • Ireneusz SzmigielIreneusz Szmigiel Posts: 135 ✭✭
    edited August 2017

    system_jars directory will work only with SOAtest 9.9+
    @rahul157 This thread might be also useful for you

  • rahul157rahul157 Posts: 29

    Thanks @Ireneusz Szmigiel & @benken_parasoft .It actually worked.

  • NitziNitzi Posts: 19

    Hi Benken,

    I was looking at your comment:
    You can also create a project in your workspace named "TestAssets" then create a child directory named "system_jars". SOAtest will automatically search for every jar file under TestAssets/system_jars/ then automatically add those to the classpath used for running java code and scripts.

    I want to understand how SOATest will automatically add all jar files in "system_jars" to the CLASSPATH just by creating the mentioned folder structure(TestAssets->system_jars). Is there any setup required for it to automatically work?

  • Ireneusz SzmigielIreneusz Szmigiel Posts: 135 ✭✭

    There are two options that SOAtest will search and add new jars to classpath:
    1. When you starting SOAtest/Virtualize Server
    2. When you trigger Reload action using GUI of SOAtest/Virtualize or make POST request with following URL http://Your_server:port/soavirt/api/v5/preferences/systemProperties/reload

    Required setup:
    -create required directories
    -copy into system_jars required jars
    -start SOAtest/Virtualize server | make POST request if server is running

    Ireneusz Szmigiel

  • benken_parasoftbenken_parasoft Posts: 399 ✭✭✭

    I want to understand how SOATest will automatically add all jar files in "system_jars" to the CLASSPATH just by creating the mentioned folder structure(TestAssets->system_jars).

    It just works. SOAtest will search that folder for all .jar files.

    Is there any setup required for it to automatically work?

    There shouldn't unless maybe you are on an older version of SOAtest. Open the docs for your version of SOAtest then search for "system_jars". For the current release, the docs are here.

  • benken_parasoftbenken_parasoft Posts: 399 ✭✭✭

    You also need to make sure that "TestAssets" was really created as a project in the workspace. It can't just be a folder that is created manually or using "mkdir". You can create it as a project from the workbench UI using "File > New > Project". From command line you can import an existing Eclipse project (directory containing .project file) using soatestcli -data workspace -import path_to_project_to_import

Sign In or Register to comment.