Forum Discussion

mariobrissette's avatar
mariobrissette
New Contributor
12 years ago

Unable to run loadUI with shell comment line on Linux

Hi,

I installed loadUI 2.6.7 on a linux Ubuntu 12.04 machine. When I tried to launch it via shell command line, it didn't work. I have a simple loadUI projet which call a soapUI. On loadUI GUI, it works perfectly on my Windows 7 machine and I'm able to see the results of the load test.

But when I tried to launch it via a command line call, it falled with the following message.

/usr/local/SmartBear/LoadUI-2.6.7/loadUI-cmd.sh: 7: /usr/local/SmartBear/LoadUI-2.6.7/loadUI-cmd.sh: 
: not found
/usr/local/SmartBear/LoadUI-2.6.7/loadUI-cmd.sh: 9: /usr/local/SmartBear/LoadUI-2.6.7/loadUI-cmd.sh:
: not found
/usr/local/SmartBear/LoadUI-2.6.7/loadUI-cmd.sh: 11: /usr/local/SmartBear/LoadUI-2.6.7/loadUI-cmd.sh:
: not found
/usr/local/SmartBear/LoadUI-2.6.7/loadUI-cmd.sh: 13: /usr/local/SmartBear/LoadUI-2.6.7/loadUI-cmd.sh:
: not found
/usr/local/SmartBear/LoadUI-2.6.7/loadUI-cmd.sh: 14: /usr/local/SmartBear/LoadUI-2.6.7/loadUI-cmd.sh: Syntax error: word unexpected (expecting "in")


Line 7, 9, 11, 13 are empty line in the loadUI-cmd.sh file. And there is a "in" keyword in line 14 so I don't understand what I'm missing. My command line call is done directly in the loadUI-cmd.sh folder and I only add the -p parameter to point out where the loadUI XML file is.

Thanks for your help!

8 Replies

  • Hello there!

    I just tried installing a fresh copy of LoadUI 2.6.8 and tried running the shellscript loadUI-cmd.sh from scratch.
    I encountered none of the issues you describe.

    Is it possible for you to install and run "dos2unix loadUI-cmd.sh" and see if that helps?
    Did you modify the script in any way?

    If it still doesn't work just try running the binary, it should work:
    ./LoadUI-Pro-2.6.8 --cmd=true

    It's located in the installation root.

    Best regards,
    Mikael
  • Osten wrote:
    Is it possible for you to install and run "dos2unix loadUI-cmd.sh" and see if that helps?
    Did you modify the script in any way?


    You got it! Running dos2unix solves this problem! Thank you very much. I transfert the LoadUI-2.6.8-64bit.sh install file in my Linux Ubuntu server using WinSCP in binary mode. But it seems that the loadUI-cmd.sh file kept all "windows" carriage return characters so it prevent the script runnning correctly.

    But now, I'm still unable to run the loadUI-cmd.sh script in shell command as I'm facing another issue. Here is my new error message:

    (java:2082): Gtk-WARNING **: cannot open display: localhost:0.0
  • mariobrissette wrote:

    But it seems that the loadUI-cmd.sh file kept all "windows" carriage return characters so it prevent the script runnning correctly.


    Yup, that's definitely what broke it.

    mariobrissette wrote:

    But now, I'm still unable to run the loadUI-cmd.sh script in shell command as I'm facing another issue. Here is my new error message:
    (java:2082): Gtk-WARNING **: cannot open display: localhost:0.0


    From the looks of it, you are running on a headless environment. And you are trying to start the command-line runner which can produce reports. In order to produce reports that involves graphs, the JavaFX2 environment has to be launched.

    Some assumptions in the JavaFX2-core are related to that a display has to exist in order to launch the framework.
    I strongly agree that this is a bad assumption, and i hope it'll be fixed in the future.

    In the meantime, however, there are workarounds. This involves installing an X virtual framebuffer, or emulating a fake X window system.

    the steps to accomplish that are as follows on a Ubuntu 12.04 Server Edition:


      Install this:
      sudo apt-get install xvfb x11-xkb-utils libxrender-dev libxtst-dev libgtk2.0-0

      Make sure this is executed. Preferably done on startup, by /etc/init.d/Xvfb or upstart:
      Run Xvfb :99 -ac

      Put this line in ~/.bashrc
      export DISPLAY=:99.0

      refresh the environment:
      source ~/.bashrc



    Now you should be able to run the commandline runner and be able to create reports if you want.

    Have a look and see if you bump into any further problems.
    If that's the case, let me know.

    Best regards,
    Mikael
  • This step run successfuly.
    Osten wrote:

    Install this:
    sudo apt-get install xvfb x11-xkb-utils libxrender-dev libxtst-dev libgtk2.0-0


    I'm not sure about the following one
    Osten wrote:

    Make sure this is executed. Preferably done on startup, by /etc/init.d/Xvfb or upstart:
    Run Xvfb :99 -ac

    Do I only need to create a file named Xvfb in the /etc/init.d/ folder and put inside the following line?
    Run Xvfb :99 -ac

    Excuse me but I'm a beginner with Ubuntu Linux so I'm a little bit confused about the script in init.d

    I had some strange message about missing fonts so I search on Internet and found an apt-get for them. Now, when I'm running loadUI-cmd.sh with my parameters, here is the new error message:
    Failed in XOpenDisplay

    (java:2644): Gtk-WARNING **: cannot open display: :99.0


    Thanks for your help!
  • Hey!

    That's quite allright, i didn't want to enforce any special way of doing it since there are many ways to do it.

    Alternative 1:
    The easiest way is probably just to drop the following line in /etc/rc.local

    Xvfb -ac :99 &


    /etc/rc.local is best interpreted as a script that is always run when a system is started.
    So restart the system and Xvfb will detach itself to the background of your system.

    Alternative 2:
    If you don't want to modify any startup-scripts then you could probably just run Xvfb in the background in the same terminal you run LoadUI

    Xvfb -ac :99 &; ./loadUI-cmd.sh


    This error message is due to Xvfb not running currently:
    "(java:2644): Gtk-WARNING **: cannot open display: :99.0"

    Hopefully that solves the last of the issues,
    let me know if you bump into something else!

    Best regards,
    Mikael
  • Hi,
    i have the same issue if i try to start loadui from commandline:

    Gtk-WARNING **: cannot open display:

    I'm using RHEL 6(64bit), and accessing server per Putty to install and run LoadUi.

    Can anyone give me some ideas? oder share some experiences using Loadui unter RHEL?

    Thanks a lot.
  • Hey Cylds,

    I believe this deserves a topic of its own as this one has been resolved.
    Even though it looks similar its not exactly the same.

    I need to know some things about your environment to proceed.
    I'm assuming its a headless machine and that you are allowed to install packages on it?
    The problem is related to that as LoadUI in headless mode still needs a display in order to start the JJavaFX2 framework (Not the UI itself).

    If you had a display connected to the machine you could simply export DISPLAY=:0.0
    If not, then you need to install Xvfb which i don't know exactly the packages for.

    But create a new topic and i'll have a look!

    Best,
    Mikael