Problems loading Sikuli or Robot Framework when used with Robot Framework Jar

1,019 views
Skip to first unread message

David

unread,
Oct 9, 2011, 11:40:18 PM10/9/11
to robotframework-users
The problem and test setup here is unlike what is described at

http://blog.mykhailo.com/2011/02/how-to-sikuli-and-robot-framework.html

Instead I'm using Java interface to Sikuli directly for use with Robot
Framework rather than Python/Jython (i.e. Sikuli script).

Works fine when run with Robot Framework installed and executed via
Jython. But doesn't work when using the self-contained Robot Framework
JAR version that has included self contained Jython.

Problem is with class path referencing. Can't figure out myself. Was
hoping perhaps the RF user community here might have some ideas.

Exact details found at my project site, particularly this page:

http://code.google.com/p/simplesikuli/wiki/IssuesWithRobotFrameworkJar

Janne Härkönen

unread,
Oct 9, 2011, 11:57:16 PM10/9/11
to mang...@gmail.com, robotframework-users
Hello David,

On Mon, Oct 10, 2011 at 6:40 AM, David <mang...@gmail.com> wrote:
> The problem and test setup here is unlike what is described at
>
> http://blog.mykhailo.com/2011/02/how-to-sikuli-and-robot-framework.html
>
> Instead I'm using Java interface to Sikuli directly for use with Robot
> Framework rather than Python/Jython (i.e. Sikuli script).
>
> Works fine when run with Robot Framework installed and executed via
> Jython. But doesn't work when using the self-contained Robot Framework
> JAR version that has included self contained Jython.
>
> Problem is with class path referencing. Can't figure out myself. Was
> hoping perhaps the RF user community here might have some ideas.

As a first debugging step, are you able to run `--help` with rf jar?

java -cp robotframework-2.5.7.jar org.robotframework.RobotFramework --help

This works for me in both Windows and Linux with a fresh download of 2.5.7 jar.

If the help works, you could then try to execute the test without
adding the Sikuli jar to class path at all, just see whether test
execution starts properly.

thanks,
--J

--
Janne Härkönen | http://reaktor.fi
http://twitter.com/#!/janneharkonen

David

unread,
Oct 10, 2011, 12:09:58 AM10/10/11
to robotframework-users
> As a first debugging step, are you able to run `--help` with rf jar?
>
> java -cp robotframework-2.5.7.jar org.robotframework.RobotFramework --help
>
> This works for me in both Windows and Linux with a fresh download of 2.5.7 jar.

Yes, that works.

> If the help works, you could then try to execute the test without
> adding the Sikuli jar to class path at all, just see whether test
> execution starts properly.

Test execution starts properly, but the library's class not found as
expected in this case. Output excerpts below. Output looks similar if
library is referenced in class path.

E:\downloads\rf>java -cp robotframework-2.5.7.jar
org.robotframework.RobotFramew
ork sikulirftest_javajython.tsv
==============================================================================
Sikulirftest Javajython
==============================================================================
Sikuli Library Demo
java.lang.N
oClassDefFoundError: org/sikuli/script/Screen
at
org.robotframework.remotelibrary.SikuliLibrary.object_exists(SikuliLi
brary.java:49)
...
| FAIL |
'False' should be true
------------------------------------------------------------------------------
Sikulirftest Javajython
| FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output: e:\downloads\rf\output.xml
Report: e:\downloads\rf\report.html
Log: e:\downloads\rf\log.html

E:\downloads\rf>

Janne Härkönen

unread,
Oct 10, 2011, 12:16:17 AM10/10/11
to mang...@gmail.com, robotframework-users
On Mon, Oct 10, 2011 at 7:09 AM, David <mang...@gmail.com> wrote:
>> As a first debugging step, are you able to run `--help` with rf jar?
>>
>> java -cp robotframework-2.5.7.jar org.robotframework.RobotFramework --help
>>
>> This works for me in both Windows and Linux with a fresh download of 2.5.7 jar.
>
> Yes, that works.

Does the help still work if you use the complete class path? (My
suspicion is now that having `.` in class path messes things up)

David

unread,
Oct 10, 2011, 12:32:33 AM10/10/11
to robotframework-users
> Does the help still work if you use the complete class path? (My
> suspicion is now that having `.` in class path messes things up)

What do you mean by complete class path? The Java package namespace to
the class w/ or w/o the class name like:

java -cp org.robotframework.remotelibrary;sikuli-
script.jar;robotframework-2.5.7.jar org.robotframework.RobotFramework
test.tsv

or

java -cp org.robotframework.remotelibrary.SikuliLibrary;sikuli-
script.jar;robotframework-2.5.7.jar org.robotframework.RobotFramework
test.tsv

I get

Exception in thread "main" Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named robot

seems on Windows, I should use ";" instead of ":". If using ":"
instead, get

Exception in thread "main" java.lang.NoClassDefFoundError: org/
robotframework/RobotFramework
Caused by: java.lang.ClassNotFoundException:
org.robotframework.RobotFramework
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: org.robotframework.RobotFramework.
Program will exit.

Both are same errors I get when using the "." instead.

David

unread,
Oct 10, 2011, 12:36:56 AM10/10/11
to robotframework-users
Oops went ahead of myself. But replacing the test.tsv with --help
still results in same errors.

Janne Härkönen

unread,
Oct 10, 2011, 12:52:00 AM10/10/11
to mang...@gmail.com, robotframework-users
On Mon, Oct 10, 2011 at 7:32 AM, David <mang...@gmail.com> wrote:
>> Does the help still work if you use the complete class path? (My
>> suspicion is now that having `.` in class path messes things up)
>
> What do you mean by complete class path? The Java package namespace to
> the class w/ or w/o the class name like:
>
> java -cp org.robotframework.remotelibrary;sikuli-
> script.jar;robotframework-2.5.7.jar org.robotframework.RobotFramework
> test.tsv
>
> or
>
> java -cp org.robotframework.remotelibrary.SikuliLibrary;sikuli-
> script.jar;robotframework-2.5.7.jar org.robotframework.RobotFramework
> test.tsv

I meant the class path with all of your dependencies, the latter form
seems to be it.

> I get
>
> Exception in thread "main" Traceback (most recent call last):
>  File "<string>", line 1, in <module>
> ImportError: No module named robot

This is *really* weird. It seems that having the additional jars in
class path causes RF imports to break. Can you try changing the order
you set the jars in the class path, so that RF is the first one? Is it
possible that Jython is contained also in sikuli-scripts.jar?

> seems on Windows, I should use ";" instead of ":".

This is true, the path entry separator is ':' in Linux and ';' in Windows.

--J

David

unread,
Oct 10, 2011, 2:00:44 AM10/10/11
to robotframework-users
> This is *really* weird. It seems that having the additional jars in
> class path causes RF imports to break. Can you try changing the order
> you set the jars in the class path, so that RF is the first one? Is it
> possible that Jython is contained also in sikuli-scripts.jar?

Rearranging the class path order did the trick.

Now that you mention it, I believe sikuli-scripts.jar does contain
Jython. I guess having 2 Jars with Jython here can cause the issue, as
running RF from Jybot worked fine w/o having to mess w/ class path
search order. Guess in such cases, will always have to set RF Jar
first.

And I wonder whether there would then be Jar packaging issues if one
wanted to package the Sikuli Jar with the RF Jar due to Jython in
both. Selective Jaring of subset of Sikuli contents then?

Thanks for the help Janne.
Reply all
Reply to author
Forward
0 new messages