Issue with reading Excel spreadsheets through a Jenkins service

3 次查看(过去 30 天)
Hello,
I have 4 Jenkins nodes that run using Jenkins as a Windows service with a specific login on Windows Server 2012. MATLAB 2015b jobs that read Excel documents work just fine on these machines. These jobs use xlsread and does not use the 'basic' import mode.
Now, I have been tasked to set up 2 more Jenkins nodes. Unfortunately, reading from Excel produces the following errors
{Error: Error in SimulateScenarios} Error using href="matlab:matlab.internal.language.introspective.errorDocCallback('xlsread', 'E:\MATLAB\R2015b_64\toolbox\matlab\iofun\xlsread.m', 251)" style="font-weight:bold">xlsread</a (<a href="matlab: opentoline('E:\MATLAB\R2015b_64\toolbox\matlab\iofun\xlsread.m',251,0)">line 251</a>)
Strangely enough, I do not receive the error when I run Jenkins, but not as a service. When I do run Jenkins as a service, I can see in the Task Manager that MATLAB is attempting to open Excel but immediately closes the process.
Are there any specific permissions that need to resolve this issue? Is there anything I can do to get a more meaningful error message that may help in debugging this issue?
Thanks, Mike Volz
  1 个评论
Maïna CABON
Maïna CABON 2018-9-11
Hello
I believe that I am facing a similar problem to yours, Mike Volz. I allow myself to restart this topic, then.
I have two machines; the master one (using Jenkins as a Windows service) and the other one, a slave, which has a Matlab license. I am trying to run a .m script to make some tests, from Jenkins.
The problem is that at some point, the script is kind of "blocked". I investigated to find this point, and it appeared to be from this next command:
[a,b]=xlsread(<excel_file_path>, 'sheet')
I tried to isolate and run it from Jenkins too, but it stopped again, with no error messages released. And it was the same for the xlswrite and xlsinfo commands. I thought it was concerning any command that was dealing with Excel, but I am able to run this one though:
Excel=actxserver('Excel.Application')
The thing is when I run my script from matlab or from Command prompt, everything works well.
Actually, what the m.script does is reading the excel file that orchestrates the simulation of the tests and, catching some values.
The other functions suggested by Matlab (importdata, textscan, readtable,etc.) are not really interesting for what I want to do although I am able to get some logs from Jenkins in this case and, it does not stuck.
When I run this line from Command prompt, it is okay:
matlab -wait -r "run('<m.script_path>'),exit;"
I have tried to change the file extension(xlsx to xls), but it was not convincing.
Like Mike Volz, I thought that some specific permissions was needed but I really have no idea.
Thanks for your help,
Maïna

请先登录,再进行评论。

回答(1 个)

Michael Mayr
Michael Mayr 2018-11-14
Hi,
I had the same issue. For me creating the folder "Desktop" in the following locations helped.
C:\Windows\SysWOW64\config\systemprofile\Desktop
C:\Windows\System32\config\systemprofile\Desktop
From Jenkins Excel is executed with the user SYSTEM. It seems Excel expects every user to have a Desktop folder.
You will have a similar issue if you create a scheduled task running Excel.
Cheers,
MiM

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by