[xwiki-users] X11 needed on the server?
Hello users, we are fighting with a spurious error occurring in our system: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getWidth' in class com.xpn.xwiki.plugin.image.ImagePluginAPI threw exception java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit @ Coll_Group_IREM-INRP- AcademiedeLyon.Introductionalamediatrice610,36? at org .apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java: 300) at org .apache .velocity.runtime.parser.node.ASTReference.execute(ASTReference.java: 203) at where basically it seems that an X11 connection is wished even though there's none (on a SuSE linux with a Sun Java). What is the normal way in Java (and on my tomcat) to avoid X11 connections and still get some image services (such as getWidth) ?? thanks in advance paul
On Wed, Mar 11, 2009 at 7:03 AM, Paul Libbrecht <[email protected]> wrote:
we are fighting with a spurious error occurring in our system: ...
where basically it seems that an X11 connection is wished even though there's none (on a SuSE linux with a Sun Java). What is the normal way in Java (and on my tomcat) to avoid X11 connections and still get some image services (such as getWidth) ??
You'll note in http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Performances#Memory (and also my response in http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Performances#comments ) the need for an additional flag for the JVM on Un*x/Linux systems -Djava.awt.headless=true (e.g. /usr/java/default/bin/java -server -Xms160m -Xmx1024m -XX:PermSize=160m -XX:MaxPermSize=320m -Djava.awt.headless=true -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=...) Add this flag, and some of the Java imaging routines stop needlessly requesting an X server. But on second though, this may not be so "needless" ... This very well could be the source of numerous scaling bugs with images and in the document converter and PDF/RTF export. The whole reason why imaging routines would be asking for the X server in the first place is to get the DPI of the display. On linux systems, that information is either defaulted, or explicitly and correctly set based on the actual display and monitor size you are using. I believe the -Djava.awt.headless=true setting allows these imaging routines to "work" but with a wrong-default DPI for the "display" they expect to display to. To solve, additional env-variables or properties need to be passed-in with a correct default DPI, such as 100x100. Or even better, do-it-right and figure out a way to get the web-browser to report the actual DPI of the user's system that will ultimately be displaying the image. For more info on potentially related scaling issues, see: http://jira.xwiki.org/jira/browse/XWIKI-2556 http://jira.xwiki.org/jira/browse/XWIKI-3216?focusedCommentId=37483&page=com... http://jira.xwiki.org/jira/browse/XWIKI-3216?focusedCommentId=37513&page=com... http://jira.xwiki.org/jira/browse/XWIKI-3216?focusedCommentId=37538&page=com... Niels http://nielsmayer.com
FYI, for more on image scaling issues associated with Linux "headless" operation of Sun Java, as related specifically to the xwiki openoffice converter, see: http://jira.xwiki.org/jira/browse/XWIKI-3216?focusedCommentId=37483&page=com...
Niels Mayer, http://nielsmayer.com<http://jira.xwiki.org/jira/secure/ViewProfile.jspa?name=nielsmayer>added a comment - 18/Feb/09 00:09
You might want to check on some missing environment variables or missed setup options. I believe OpenOffice is "thinking" at the wrong DPI ... since it doesn't actually have a display from which to get a real DPI measurement. Google says others have had these sorts of problems: http://www.mail-archive.com/[email protected]/msg07491.html And this http://www.hippocms.org/display/CMS/How+to+configure+the+File+Import+Service... option "rescaleBitmaps" may be needed for correct handling of "resolution independence". Since we can't really know the end-resolution for importing an office document, it's more reasonable to set it at a standard value for today's display's, e.g. 100DPI. ... What is basically needed is to "synthesize" the following X server setting normally in ~/.Xresources because this is probably where OOo gets it's DPI value: "Xft.dpi: 100" If I am correct with my conjecture, the following explains in more detail ( http://www.hippocms.org/display/CMS/How+to+configure+the+File+Import+Service) .................. When you upload a document you can specify three additional parameters by suffixing them to the URL using standard URL parameter syntax: - rescaleBitmaps of type boolean. This parameter defaults to false. Normally bitmaps are extracted as is. This could lead to bitmaps that are smaller or larger than they appear in the document. By setting this parameter to true, the bitmaps will be rescaled to the size specified in the document using the dots per inch (DPI) specified by dpiForBitmaps. - convertWmfsToBitmaps of type boolean. This parameter default to false. Some files contain images in the Windows Meta Files format. These files cannot be used as is for web pages. By setting this parameter to true the Windows Meta Files will be converted to bitmaps. The DPI specified by dpiForBitmaps is used to determine the size of the bitmap to produce. - dpiForBitmaps of type integer. This parameter defaults to 96. The DPI to use for rescaling bitmaps and converting Windows Meta Files to bitmaps. This parameter is only applicable if one of the options above is enabled. Note that no error will be returned if invalid values are passed for the parameters. Instead the default values will be used. [ Show ยป<http://jira.xwiki.org/jira/browse/XWIKI-3216?focusedCommentId=37483&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_37483>] Niels Mayer, http://nielsmayer.com<http://jira.xwiki.org/jira/secure/ViewProfile.jspa?name=nielsmayer>added a comment - 18/Feb/09 00:09 You might want to check on some missing environment variables or missed setup options. I believe OpenOffice is "thinking" at the wrong DPI ... since it doesn't actually have a display from which to get a real DPI measurement. Google says others have had these sorts of problems: http://www.mail-archive.com/[email protected]/msg07491.html... this http://www.hippocms.org/display/CMS/How+to+configure+the+File+Import+Service... option "rescaleBitmaps" may be needed for correct handling of "resolution independence". Since we can't really know the end-resolution for importing an office document, it's more reasonable to set it at a standard value for today's display's, e.g. 100DPI. ... What is basically needed is to "synthesize" the following X server setting normally in ~/.Xresources because this is probably where OOo gets it's DPI value: "Xft.dpi: 100" If I am correct with my conjecture, the following explains in more detail ( http://www.hippocms.org/display/CMS/How+to+configure+the+File+Import+Service) .................. When you upload a document you can specify three additional parameters by suffixing them to the URL using standard URL parameter syntax: - rescaleBitmaps of type boolean. This parameter defaults to false. Normally bitmaps are extracted as is. This could lead to bitmaps that are smaller or larger than they appear in the document. By setting this parameter to true, the bitmaps will be rescaled to the size specified in the document using the dots per inch (DPI) specified by dpiForBitmaps. - convertWmfsToBitmaps of type boolean. This parameter default to false. Some files contain images in the Windows Meta Files format. These files cannot be used as is for web pages. By setting this parameter to true the Windows Meta Files will be converted to bitmaps. The DPI specified by dpiForBitmaps is used to determine the size of the bitmap to produce. - dpiForBitmaps of type integer. This parameter defaults to 96. The DPI to use for rescaling bitmaps and converting Windows Meta Files to bitmaps. This parameter is only applicable if one of the options above is enabled. Note that no error will be returned if invalid values are passed for the parameters. Instead the default values will be used.
participants (2)
-
Niels Mayer -
Paul Libbrecht