Error sun/awt/X11GraphicsEnvironment

0
I tested Jasper code on my machine and it is working well. Whereas on Unix server when I try to run during call to fillReporttoFile method I am getting java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment..


Also please suggest can I use any alternative method to fill the reports which does not make call to awt package.
Please help me ASAP what I should do?
igjyoti's picture
Joined: Oct 12 2006 - 3:42am
Last seen: 12 years 7 months ago

5 Answers:

0
I have encountered that same problem. It is related to a bug in the underlying java graphics environment with how the graphics objects are being created to render report portions on unix/linux.

To counteract this error, use -Djava.awt.headless=true, which resolves the issue. What the -Djava.awt.headless flag does is instructs the JVM to ignore any exceptions thrown that have to do with not having a GUI when initializing the GraphicsContext.
rsilver@ns.sympatico.ca's picture
Joined: Aug 4 2006 - 3:46am
Last seen: 12 years 9 months ago
0
You need to supply a java environment variable when running headless or with an unset Display variable:
Code:
"-Djava.awt.headless=true" </td></tr></tbody></table>
riftware's picture
Joined: Oct 22 2006 - 1:42pm
Last seen: 12 years 7 months ago
0
I too encountered this problem and I have solved it by adding

Code:
<br />
System.setProperty("java.awt.headless", "true"«»);<br />
</td></tr></tbody></table><br />
<br />
in my java code.
mathewrond's picture
Joined: Aug 21 2006 - 5:56pm
Last seen: 12 years 9 months ago
0
I added same codes in my catalina.out, but there are new problems, just like that:
exception

javax.servlet.ServletException
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.reportJasper_jsp._jspService(reportJasper_jsp.java:589)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.it45.hhds.AuthorizationFilter.doFilter(AuthorizationFilter.java:133)


root cause

java.lang.NoClassDefFoundError
net.sf.jasperreports.engine.xml.JRBoxFactory.setBoxAttributes(JRBoxFactory.java:102)
net.sf.jasperreports.engine.xml.JRBoxFactory.createObject(JRBoxFactory.java:71)
org.apache.commons.digester.FactoryCreateRule.begin(FactoryCreateRule.java:389)
org.apache.commons.digester.Digester.startElement(Digester.java:1361)
org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
org.apache.commons.digester.Digester.parse(Digester.java:1647)
net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:238)
net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:225)
net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:213)
net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:167)
net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:151)
net.sf.jasperreports.engine.JasperManager.loadXmlDesign(JasperManager.java:971)
org.apache.jsp.reportJasper_jsp._jspService(reportJasper_jsp.java:244)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.it45.hhds.AuthorizationFilter.doFilter(AuthorizationFilter.java:133)
wildhuman's picture
Joined: Sep 27 2006 - 1:33am
Last seen: 12 years 7 months ago
0
Hi Teodor,

I had faced the same issues earlier and I remember we had resolved that by installing xorg-x11-Xvfb-6.8.1-23.EL.i386.rpm . I recently installed Linux on a different machine just to re simulate the error but to my surprise all my reports came out well. without the common error message cant connect to xll window.

The version of Linux available to me is Red Hat Enterprise Linux version 3.0 and kernel 2.4


As this issue been fixed with the newer version of jasperreports i.e. beyond version jasperreports-1.2.7


thanks & regards,

Santosh
asd123's picture
1
Joined: Oct 26 2006 - 12:22am
Last seen: 12 years 6 months ago
Feedback
randomness