Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7765239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:07:08+00:00 2026-06-01T15:07:08+00:00

I’m running matlab on my local machine and I’m calling the following function from

  • 0

I’m running matlab on my local machine and I’m calling the following function from Java (running in a tomcat web server):

function df = getFig(file)
    f = openfig(file,'reuse','invisible');
    set(f, 'Color', [1,1,1]);
    df = webfigure(f);
    close(f);
end

This works fine locally but when running on our headless unix webserver we get this error:

{Error using set
Width and height must be > 0

Error in
renderwebfigure>@(childHnd,childPos)set(childHnd,'Position',[childPos(1)*parameters.width-clipRect(1)+extraRenderSpace,childPos(2)*parameters.height-clipRect(2)+extraRenderSpace,childPos(3)*parameters.width,childPos(4)*parameters.height])
(line 70)



Error in renderwebfigure>cropFigureAndReturnCData (line 70)



Error in renderwebfigure (line 31)


} 
Mar 30, 2012 4:08:17 PM org.apache.catalina.core.ApplicationContext log
INFO: WebFigures: com.mathworks.toolbox.javabuilder.services.ServiceException: com.mathworks.toolbox.javabuilder.services.ServiceException: com.mathworks.toolbox.javabuilder.services.ServiceDispatchTargetException: com.mathworks.toolbox.javabuilder.services.ServiceException: java.lang.reflect.InvocationTargetException
                at com.mathworks.toolbox.javabuilder.webfigures.WebFiguresServlet.doGet(WebFiguresServlet.java:161)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
                at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
                at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
                at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:304)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                at java.lang.Thread.run(Unknown Source)
Caused by: com.mathworks.toolbox.javabuilder.services.ServiceException: com.mathworks.toolbox.javabuilder.services.ServiceDispatchTargetException: com.mathworks.toolbox.javabuilder.services.ServiceException: java.lang.reflect.InvocationTargetException
                at com.mathworks.toolbox.javabuilder.webfigures.service.request.WebFigureRenderRequest.process(WebFigureRenderRequest.java:230)
                at com.mathworks.toolbox.javabuilder.webfigures.service.request.WebFigureRenderRequest.process(WebFigureRenderRequest.java:38)
                at com.mathworks.toolbox.javabuilder.webfigures.service.WebFigureServiceFactory$WebFigureServiceImpl.processRequest(WebFigureServiceFactory.java:61)
                at com.mathworks.toolbox.javabuilder.webfigures.service.WebFigureServiceFactory$WebFigureServiceImpl.processRequest(WebFigureServiceFactory.java:42)
                at com.mathworks.toolbox.javabuilder.webfigures.WebFiguresServlet$1.call(WebFiguresServlet.java:147)
                at com.mathworks.toolbox.javabuilder.webfigures.WebFiguresServlet$1.call(WebFiguresServlet.java:145)
                at com.mathworks.toolbox.javabuilder.webfigures.WebFiguresServlet.doGet(WebFiguresServlet.java:158)
                ... 17 more
Caused by: com.mathworks.toolbox.javabuilder.services.ServiceDispatchTargetException: com.mathworks.toolbox.javabuilder.services.ServiceException: java.lang.reflect.InvocationTargetException
                at com.mathworks.toolbox.javabuilder.services.StatefulServicePeerCache.dispatch(StatefulServicePeerCache.java:174)
                at com.mathworks.toolbox.javabuilder.webfigures.service.request.WebFigureRenderRequest.process(WebFigureRenderRequest.java:221)
                ... 23 more
Caused by: com.mathworks.toolbox.javabuilder.services.ServiceException: java.lang.reflect.InvocationTargetException
                at com.mathworks.toolbox.javabuilder.webfigures.service.WebFigureBinder$WebFigurePeerImpl.renderImage(WebFigureBinder.java:260)
                at com.mathworks.toolbox.javabuilder.webfigures.service.WebFigureBinder$WebFigurePeerImpl.renderEncoded(WebFigureBinder.java:329)
                at com.mathworks.toolbox.javabuilder.webfigures.service.request.WebFigureRenderRequest$1.execute(WebFigureRenderRequest.java:223)
                at com.mathworks.toolbox.javabuilder.webfigures.service.request.WebFigureRenderRequest$1.execute(WebFigureRenderRequest.java:221)
                at com.mathworks.toolbox.javabuilder.services.StatefulServicePeerCache.dispatch(StatefulServicePeerCache.java:171)
                ... 24 more
Caused by: java.lang.reflect.InvocationTargetException
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at com.mathworks.toolbox.javabuilder.webfigures.service.WebFigureBinder$WebFigurePeerImpl$1.call(WebFigureBinder.java:254)
                at com.mathworks.toolbox.javabuilder.webfigures.service.WebFigureBinder$WebFigurePeerImpl$1.call(WebFigureBinder.java:252)
                at com.mathworks.toolbox.javabuilder.webfigures.service.WebFigureBinder$WebFigurePeerImpl.whileLocked(WebFigureBinder.java:191)
                at com.mathworks.toolbox.javabuilder.webfigures.service.WebFigureBinder$WebFigurePeerImpl.renderImage(WebFigureBinder.java:252)
                ... 28 more
Caused by: com.mathworks.toolbox.javabuilder.MWException: Error using set
Width and height must be > 0
                at com.mathworks.toolbox.javabuilder.internal.MWMCR.mclFeval(Native Method)
                at com.mathworks.toolbox.javabuilder.internal.MWMCR.access$600(MWMCR.java:23)
                at com.mathworks.toolbox.javabuilder.internal.MWMCR$6.mclFeval(MWMCR.java:833)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at com.mathworks.toolbox.javabuilder.internal.MWMCR$5.invoke(MWMCR.java:731)
                at $Proxy4.mclFeval(Unknown Source)
                at com.mathworks.toolbox.javabuilder.internal.MWMCR.invoke(MWMCR.java:406)
                at com.mathworks.toolbox.javabuilder.webfigures.service.WebFigureServiceMCR.renderwebfigure(WebFigureServiceMCR.java:211)
                ... 36 more

Other figures that I generate either my using plot(1:10); work fine on both platforms. So it seems the problem is with the openfig function. Also, if I path in a path to a file that doesn’t exist I get a file not found error rather than the width and height must be > 0 error

Calling this however works:

function w = getplot
    f = figure('visible', 'off');
    plot(1:10);
    w = webfigure(f);
    close(f);
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:07:09+00:00Added an answer on June 1, 2026 at 3:07 pm

    So it turned out for some reason the default size for these on a headless display (at least on our linux distro) is 0. This causes an error before the webfigure can be manually resized. So ultimately the fix was:

    set(f, ‘pos’, [0 0 100 100]);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.