cashlalala / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

pdfs and graphs dont display #144

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. bring up monitoring interface
2. click pdf button
3.

What is the expected output? 
Graphs Displayed
PDF Generated

What do you see instead?
Broken images
Invalid/empty pdf file

What version of the product are you using? 
1.31.0

On what application server
Tomcat 6

JDK
OpenJDK 64-bit 1.6.0_20

operating system
Ubuntu 10.04 / Linux 2.6.32

Please provide any additional information below.
Stack-trace
java.lang.Error: Probable fatal error:No fonts found.
      at sun.font.FontManager.getDefaultPhysicalFont(FontManager.java:1088)
      at sun.font.FontManager.initialiseDeferredFont(FontManager.java:967)
      at sun.font.CompositeFont.doDeferredInitialisation(CompositeFont.java:254)
      at sun.font.CompositeFont.getSlotFont(CompositeFont.java:334)
      at sun.font.CompositeGlyphMapper.initMapper(CompositeGlyphMapper.java:81)
      at sun.font.CompositeGlyphMapper.<init>(CompositeGlyphMapper.java:62)
      at sun.font.CompositeFont.getMapper(CompositeFont.java:390)
      at sun.font.StandardGlyphVector.init(StandardGlyphVector.java:1115)
      at sun.font.StandardGlyphVector.<init>(StandardGlyphVector.java:172)
      at java.awt.Font.getStringBounds(Font.java:2331)
      at java.awt.Font.getStringBounds(Font.java:2241)
      at java.awt.Font.getStringBounds(Font.java:2275)
      at org.jrobin.graph.ImageWorker.getStringWidth(ImageWorker.java:166)
      at org.jrobin.graph.RrdGraph.getSmallFontCharWidth(RrdGraph.java:594)
      at org.jrobin.graph.RrdGraph.initializeLimits(RrdGraph.java:319)
      at org.jrobin.graph.RrdGraph.createGraph(RrdGraph.java:88)
      at org.jrobin.graph.RrdGraph.<init>(RrdGraph.java:59)
      at net.bull.javamelody.JRobin.graph(JRobin.java:200)
      at net.bull.javamelody.MonitoringController.doGraph(MonitoringController.java:388)
      at net.bull.javamelody.MonitoringController.doReport(MonitoringController.java:150)
      at net.bull.javamelody.MonitoringFilter.doMonitoring(MonitoringFilter.java:289)
      at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:122)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:558)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
      at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
      at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
      at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
      at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
      at java.lang.Thread.run(Thread.java:636)

Can you describe what font dependencies javamelody has and how to setup the JVM 
to fulfill them? I am running it on a Ubuntu server that does not have X 
installed but does have font files.

Original issue reported on code.google.com by mart788@gmail.com on 30 Sep 2011 at 4:50

GoogleCodeExporter commented 9 years ago
This issue seems related to the JDK or Ubuntu (and not related to javamelody).
According to a short web search, it may be fixed by using the Sun/Oracle JDK 
(and not OpenJDK) or by installing X window or by adding some files in some 
font directory.

Basically, some fonts are needed for the graphics and the JDK does not find 
them.
The JRobin classes include the following fonts (the first one seems to be the 
one in your stack-trace):

    /**
     * Default font name, determined based on the current operating system
     */
    String DEFAULT_FONT_NAME = System.getProperty("os.name").toLowerCase().contains("windows") ?
            "Lucida Sans Typewriter" : "Monospaced";

    /**
     * Default graph small font
     */
    String DEFAULT_MONOSPACE_FONT_FILE = "DejaVuSansMono.ttf";

    /**
     * Default graph large font
     */
    String DEFAULT_PROPORTIONAL_FONT_FILE = "DejaVuSans-Bold.ttf";

Please tell your findings, Thanks.

Original comment by evernat@free.fr on 30 Sep 2011 at 5:24

GoogleCodeExporter commented 9 years ago
We did not have a copy of DejaVuSansMono.ttf or DejaVuSans-Bold.ttf on that 
server.  We verified that adding/removing those files affects whether the 
graphs/pdfs work.

Also we setup a fonts.conf alias:
        <match target="pattern">
                <test qual="any" name="family">
                        <string>mono</string>
                </test>
                <edit name="family" mode="assign">
                        <string>monospace</string>
                </edit>
        </match>

Thanks for your help

Original comment by mart788@gmail.com on 30 Sep 2011 at 6:30

GoogleCodeExporter commented 9 years ago
ok, bye

Original comment by evernat@free.fr on 30 Sep 2011 at 9:02