cannot find images running from Tomcat Jenkins

Asked by twitty

I have a maven project that works fine in Eclipse ID and local Jenkins system. I deployed jenkins on Tomcat and setup the same maven project on Tomcat Jenkins.

I am having error that same imge cannot be found anymore. I double checked the images are there in the resource and target/test-classes. Any suggesting please?

/C:/.jenkins/workspace/spicebrowser/target/test-classes/image.png
/C:/.jenkins/workspace/spicebrowser/target/test-classes/image.png
Jun 28, 2013 4:41:51 PM com.rovi.spiceApp.SpiceApp checkIfImageExists
WARNING: Could not find the image: image.png

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
twitty
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

These are not Sikuli messages.

How is the message "WARNING...." generated?

Revision history for this message
twitty (twittysnow) said :
#2

 if (SCREEN.exists(getImagePath(imageName)) == null) {

   LOG.log(Level.WARNING, "Could not find the image: " + imageName);
   result = false;

  }

Actually, I have a method created like that WARNING is generated by the Logger log. I am trying to figure out why only it happens when running from Jenkins deployed in Tomcat. The images file inside C:/.jenkins/..../test-classes has the read access too.
If I run the local Jenkins, it works fine.

Thanks a lot for the response and answer!!

Revision history for this message
RaiMan (raimund-hocke) said :
#3

I do not know, what your function getImagePath() is doing. Already checked this one?

Revision history for this message
twitty (twittysnow) said :
#4

yes. I did. I think I may have to take a look at Tomcat configuration for Jenkins. It seems that Jenkins running as webapp on Tomcat cannot access to C drive .jenkins sub-folders.

Thanks for the help!

Revision history for this message
twitty (twittysnow) said :
#5

I think the issue is my sikuli tests are not able to click/interact with the screen.
I checked the Tomcat Logon option "Allow service to interact with Desktop" and restart the webserivce. But still the same.
I installed the Tomcat and Jenkins on the physical machine and using Sikuli-script API.
I am not sure what I have missed.

getImagePath() is just trying to get the img file from test/resource folder

Thanks!

if (SCREEN.exists(getImagePath(imageName)) == null) {

   LOG.log(Level.WARNING, "Could not find the image: " + imageName);
   result = false;

  }

 public String getImagePath(String imageName) {
  String imageBasePath = getClass().getResource("/" + imageName)
    .getFile();
  System.out.println(imageBasePath);
  File file = new File(imageBasePath);
  imageBasePath = file.getAbsolutePath();
  //System.out.println(imageBasePath);
  return imageBasePath;
 }

Revision history for this message
twitty (twittysnow) said :
#6

any suggestions please?

Revision history for this message
twitty (twittysnow) said :
#7

If I do not use Tomcat, running scripts from the local Jenkins, it works fine and scripts can interact with the screen. Wondering if it is something with running with window services???

thanks for the help in advance!

Revision history for this message
RaiMan (raimund-hocke) said :
#8

no, I think it has something to do with class loaders.

I think on Tomcat there are different class loaders, that search in different locations.

Ever debugged the situation in your IDE?

Revision history for this message
RaiMan (raimund-hocke) said :
#9

Sorry, I think that was too fast.

Just realized, that you are complaining that it does not click.

So i suppose, that the image is loaded correctly and is found on the screen.

I guess it has in fact something to do with being a service.
I vaguely remember that this was already asked before and it has a solution - but I do not have any idea.

Just found something: https://answers.launchpad.net/sikuli/+question/153455
But that is what you already did :-(

Revision history for this message
twitty (twittysnow) said :
#10

Thanks!!

Yeah, most parts. Somehow, java -jar sikili-script.jar xxx.sikuli cannot run from the command line. But, it did not give me any errors running from eclipse, the local jenkins and jenkins deployed in tomcat. So I think it may be okay?

screen.find() throws this error when running from jenkins deployed in tomcat though the image is on the screen...

can not find <image name> on the screen.

Revision history for this message
twitty (twittysnow) said :
#11

I meant to post it sooner that I was able to solve it. When Tomcat is running as the webservice, scripts cannot interactive with the window desktop. It was solved when stopping the tomcat service then just launching the tomcat from tomcatx.exe .