On Wed, Mar 11, 2009 at 7:03 AM, Paul Libbrecht <paul(a)activemath.org> 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&pag…
http://jira.xwiki.org/jira/browse/XWIKI-3216?focusedCommentId=37513&pag…
http://jira.xwiki.org/jira/browse/XWIKI-3216?focusedCommentId=37538&pag…
Niels
http://nielsmayer.com