Cannot connect to X11 window exception

By: Kevin Chen - kchena2w
Cannot connect to X11 window exception
2003-02-24 12:05
I'm using JasperReports on the server side (weblogic server) to generate report for a webapp. I got the following exceptions:

java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:54)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:115)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:53)
at java.awt.Font.initializeFont(Font.java:259)
at java.awt.Font.<init>(Font.java:343)
at java.awt.Font.getFont(Font.java:360)
at sun.java2d.SunGraphicsEnvironment.getBestFontFor(SunGraphicsEnvironment.java:560)
at java.awt.font.TextLine$ACIFontSource.getBestFontAt(TextLine.java:760)
at java.awt.font.TextLine.getComponents(TextLine.java:886)
at java.awt.font.TextMeasurer.generateComponents(TextMeasurer.java:149)
at java.awt.font.TextMeasurer.initAll(TextMeasurer.java:124)
at java.awt.font.TextMeasurer.<init>(TextMeasurer.java:87)
at java.awt.font.LineBreakMeasurer.<init>(LineBreakMeasurer.java:280)
at java.awt.font.LineBreakMeasurer.<init>(LineBreakMeasurer.java:252)
at dori.jasper.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:330)
at dori.jasper.engine.fill.JRFillTextField.prepare(JRFillTextField.java:461)
at dori.jasper.engine.fill.JRFillBand.prepareElements(JRFillBand.java:467)
at dori.jasper.engine.fill.JRFillBand.fill(JRFillBand.java:408)
at dori.jasper.engine.fill.JRVerticalFiller.fillTitle(JRVerticalFiller.java:350)
at dori.jasper.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:250)
at dori.jasper.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:160)
at dori.jasper.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:457)
at dori.jasper.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:373)
at dori.jasper.engine.fill.JRFiller.fillReport(JRFiller.java:114)
at dori.jasper.engine.JasperFillManager.fillReport(JasperFillManager.java:217)


The code I used to fill report in my sevlet is like:

File reportFile = new File(reportFileName);
JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportFile.getPath());
Map parameters = new HashMap();
parameters.put("BaseDir", reportFile.getParentFile());
parameters.put("StartingTime", new Long(start.getTime()));
parameters.put("EndingTime", new Long(end.getTime()));
parameters.put("StartingTimeString", "Starting Time: "+startStr);
parameters.put("EndingTimeString", "Ending Time: "+endStr);
parameters.put("MaxRowNums", "300000");

Connection conn = DBUtils.getConnection();

JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport,
parameters,
conn
);


Thanks,
Kevin




By: Matt Hall - matt2k
RE: Cannot connect to X11 window exception
2003-02-24 14:40

I am also having this problem when trying to generate a report in HTML format, when I try to generate the report for PDF or Excel I get a different NoClassDefFoundException on JRFiller.java line 109.

I wasn't aware of needing to configure any displays on the server to generate reports, I'm going to reread the documentation to see if there's any mention made.

Matt




By: Kevin Chen - kchena2w
Found a solution
2003-02-24 14:52
Please see the previous thread on this issue at http://sourceforge.net/forum/message.php?msg_id=1870792. I followed Rick Sperko's suggestion and used PJA to bypass the issue. I have to add two additional sys property settings to make it work:

-Djava2d.font.usePlatformFont=false
-Djava.awt.fonts=<path_to_your_jre_lib_fonts>

-Kevin




By: Eric Tan - neltan
RE: Cannot connect to X11 window exception
2003-02-24 23:17
Please read the previous thread. You'll solve it!
http://sourceforge.net/forum/forum.php?thread_id=775203&forum_id=113529
http://sourceforge.net/forum/forum.php?thread_id=815314&forum_id=113529
2002 JI Open Discussion's picture
Joined: Aug 10 2006 - 3:28am
Last seen: 17 years 1 month ago

0 Answers:

No answers yet
Feedback
randomness