Offscreen Imaging: X11, DISPLAY, BufferedImage

A discussion forum for JFreeChart (a 2D chart library for the Java platform).

Error - Can't connect to X11 window

Postby Krishna » Fri Aug 15, 2003 5:04 pm

Hi I have used jcommon-0.8.0.jar, jfreechart-0.9.8.jar, jfreechart-0.9.8-demo.jar files to generate the graphs. I developed this application in Windows environment. It is working fine and I have the graphs generated properly in Windows.

Then I moved the same on SunOS 5.6 and I got the below error. Can somebody help me to solve this . This is quite urgent., and somebody gimme a solution so that I can fix this issue.


Exception in thread "main" 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:5
4)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:115)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvi
ronment.java:53)
at java.awt.Font.initializeFont(Font.java:259)
at java.awt.Font.<init>(Font.java:293)
at org.jfree.chart.axis.AxisConstants.<clinit>(Unknown Source)
at org.jfree.chart.axis.Axis.<init>(Unknown Source)
at org.jfree.chart.axis.ValueAxis.<init>(Unknown Source)
at org.jfree.chart.axis.NumberAxis.<init>(Unknown Source)
at org.jfree.chart.axis.HorizontalNumberAxis.<init>(Unknown Source)
at org.jfree.chart.ChartFactory.createLineXYChart(Unknown Source)
at com.graph.services.GraphGenerator.graphGeneration(GraphGenerator.java
:206)
at com.graph.services.GraphGenerationTest.main(GraphGenerationTest.java:
16)

Thanks in advance. Looking forward to get the solution. Your help would be highly appreciable.

Thanks
Krishna
 

tomcat3.2 and j2sdk1.4.1_05

Postby shanti » Thu Oct 23, 2003 10:18 pm

Hi

I have tomcat 3.2 with jdk1.4.1_05 running. I have put the -Djava.awt.headless=true property into the java cmd in tomcat.sh file.
But it still give me the X11 error when I access the a demo jsp (barchart.jsp). The error is:

javax.servlet.ServletException: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.

My java cmd looks like this:

$JAVACMD -Djava.awt.headless=true -Dtomcat.home=${TOMCAT_HOME} org.apache.tomcat.startup.Tomcat -f $TOMCAT_HOME/conf/${SERVER_XML} $TOMCAT_OPTS

Does it have anything to do with tomcat 3.2 or does it matter if I use tomcat3.2 or 4?

Thanks for any help
Shanti
shanti
 
Posts: 1
Joined: Thu Oct 23, 2003 9:58 pm

JDK1.2.2

Postby geindsys » Fri Nov 21, 2003 4:37 pm

Any idea how to solve this under JDK1.2.2 - that is a limitation and I cannot upgrade the version.
geindsys
 
Posts: 72
Joined: Wed Oct 08, 2003 7:05 pm

X11 problem! How to integrate with PJA on AIX???

Postby phamdinhnguyen » Fri Jan 30, 2004 4:43 pm

Guillermo Castro wrote:I wonder,

Why don't you use the PJA library to avoid this kind of problems. The library is GPL, so it can be included with JFreeCharts, and it would make JFreeCharts work on any environment. I've use it for a servlet that renders barcodes, and now I can put my servlet on any server, linux, win or solaris, w/o any problem. There's almost no need to change the code, so...

Anyways, it's just a thought.

Guillermo


Can someone help with details as how to achieve what Guillermo was refering to "include the PJA library with JFreeCharts, and it would make JFreeCharts work on any environment"?

Guillermo,
Can you describe what it take to do what you recommended?

I need to do this on AIX machines.
Thanks
phamdinhnguyen
 
Posts: 22
Joined: Thu Jan 29, 2004 8:28 pm

AIX 43 / JDK 131 / Websphere 403, and X11 DISPLAY problem

Postby phamdinhnguyen » Tue Feb 10, 2004 6:28 pm

:D
My final working solution for AIX, after exhausting all possible settings/configurations with PureJavaAWT, is XVFB. If you MUST get a solution, check out this link for details:

http://publibn.boulder.ibm.com/doc_link ... Header_363

Best luck!
phamdinhnguyen
 
Posts: 22
Joined: Thu Jan 29, 2004 8:28 pm

Postby Guest » Tue Nov 30, 2004 11:53 am

On RH AS3 with Tomcat 4.1 it is working with
CATALINA_OPTS "-Djava.awt.headless=true"
in the catalina.sh

thx
Guest
 

java.lang.NoClassDefFoundErroratorg.jfree.chart.ChartFactory

Postby sreenivasarao » Wed Jan 19, 2005 3:27 pm

Hi..
my charts working fine on windows but when i copied to linux , it is reporting the error like
java.lang.NoClassDefFoundError at org.jfree.chart.ChartFactory.createBarChart(ChartFactory.java:515)
i am using jcommon-0.9.6 and jfreechart-0.9.21.
please help me why it is hapening.please urgent.
sreenivasarao
 

java.lang.NoClassDefFoundErroratorg.jfree.chart.ChartFactory

Postby sreenivasarao » Wed Jan 19, 2005 3:43 pm

Hi..
my charts working fine on windows but when i copied to linux , it is reporting the error like
java.lang.NoClassDefFoundError at org.jfree.chart.ChartFactory.createBarChart(ChartFactory.java:515)
i am using jcommon-0.9.6 and jfreechart-0.9.21.
I am using Red Hat Linux release 7.3 (Valhalla) and jdk1.4.2
please help me why it is hapening.please urgent.
sreenivasarao
 

problem in display of multiple charts is jsp

Postby mjitch » Sat Mar 19, 2005 4:01 pm

hi guys,

I am using JfreeChart to display chart reports in jsp pages. I used a servlet to buffer the images and encode them into respective png format and display them as png images. Problem here is when i create multiple charts in the same page passing different parameters, i get the image of the last chart only. Any suggestions on this?

Thanx & regards,

mjitch
mjitch
 

Postby Guest » Fri Apr 29, 2005 7:10 pm

Hi all..
My chart woks fine on windows, but when i deply my application on linux, it does not work, but i don't get any exception or message error, or something that tell me why it isn't working...

help??

Thanks
Lucas
Guest
 

CE Wolf Charts now displaying OK

Postby Gary Healy » Tue Aug 09, 2005 2:23 am

Guys. Thanks very much.

We were also having problems under WebSphere on AIX trying to display the CE Wolf Charts. Errors occuring were
Error 500: Can't connect to X11 window server using '(192:0' as the value of the DISPLAY variable
OR
Error 500: org/jfree/chart/axis/NumberAxis

We added the System Property
Name = java.awt.headless
Value = true

as discussed above.

The problem is now fixed.

Thanks Gary.
Gary Healy
 

Re: Offscreen Imaging: X11, DISPLAY, BufferedImage

Postby Guest » Sat Oct 08, 2005 3:26 pm

RC wrote:I asked this question long time ago, but people only tell me use Xvfb without
any instructions.

Finally I got the Xvfb work with JRE 1.3.x, tomcat 3.x, Redhat Linux 7.2.

Start Xvfb with server 1 (server 0 is default for console),
screen 0 (I only have one monitor screen),
size 1280x1024,
depth 8
In background or in rc startup script.

Xvfb :1 -screen 0 1280x1024x8 &

Then longin and
setenv DISPLAY :1.0 (for csh, tcsh)
or
export DISPLAY=:1.0 (for sh, ksh, bash)
Then recompiled your code(s) for tomcat servlet.
javac YourJFreeChartClass.java

When you run your servlet or JSP vs. browser, YourJFreeChartClass
will dump the JPEG image and display to your browser.
8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8)
Guest
 

Headless operation still a problem

Postby Guest » Thu Oct 27, 2005 9:04 pm

Hi,

I've been using CE Wolf on a headless Tomcat server running Solaris 8.

Setting the CATALINA_OPTS to "headless" works well. Without it, I get
the standard X11 error.

My problem is that the sys admin won't set the "headless" flag on the
production system because it might interfere with other servlets. He says that if I set

System.setProperty("java.awt.headless","true")

in my code, my troubles are over.


When I try this, the canonical X11 error goes away, but
I get a message from cewolf that it cannot find a
render like so:

java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
at
java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1041)
at
java.awt.image.BufferedImage.getGraphics(BufferedImage.java:1031)
at
de.laures.cewolf.util.RenderingHelper.renderException(RenderingHelper.java:64)
at
de.laures.cewolf.CewolfRenderer.logAndRenderException(CewolfRenderer.java:198)
at
de.laures.cewolf.CewolfRenderer.doGet(CewolfRenderer.java:158)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

This is not too surprising, I guess. Its as if the
classloader simply says "Oh, headless! Gotcha. You
won't be needing any of this stuff. No Graphics for you."

CE Wolf is just wrapping jfc at this point and they suggested that you
might know of some way (some method or property) that would alert
the classloader that it would need to find these classes, even if
headless was set in the System properties.

Thanks, and I'll cross post any responses back to CE Wolf.

John
Guest
 

Postby TuRu » Sun Nov 20, 2005 11:55 am

Hello friends,

here is my script for running my App (using CEWOLF for charts). I hope it can help:

#!/bin/bash
Xvfb :1 -screen 0 800x600x16 &
export DISPLAY=:1.0
export CATALINA_OPTS="-Djava.awt.headless=true"
export JAVA_OPTS="-Xms100m -Xmx800m"
export JAVA_HOME=/home/applicatioin/j2sdk1.4.2_06/
/home/appplication/apache-tomcat-5.5.12/bin/catalina.sh $1

$1 for run, start, stop..

Its a Debian 3 with kernel 2.4, using apache2.0.54, tomcat 5.5.12, mod_jk and JRE 1.4.2_06.

In debian, i´ve getting de missing libraries using this commands:

apt-file update && apt-file search libXtst.so.6

apt-get install libx11-6

Thanks.
TuRu
 

Re: Solaris 2.8 and SunONE Enterprise Server 6.0 X11 issue

Postby Guest » Fri Dec 09, 2005 6:25 pm

juanny wrote:Hi guys:
I have tried java 1.4 with the java.awt.headless=true setting at the servlet engine configuration level jvm12.conf and on an initialization servlet and still can't get chartdemo1 to work. Anybody running SunONE
and JFreeCharts? Please advice.
ja

============ Error trace ======================
[01/Aug/2003:01:08:38] failure ( 6250): Internal error: Unexpected error condition thrown (java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.,Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.), stack: 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 <Unloaded Method>
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName0(Compiled Code)
at java.lang.Class.forName(Compiled Code)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:63)
at java.awt.Font.initializeFont(Font.java:262)
at java.awt.Font.<init>(Font.java:292)
at <Unloaded Method>
at org.jfree.chart.axis.Axis.<init>(Unknown Source)
at org.jfree.chart.axis.CategoryAxis.<init>(Unknown Source)
at org.jfree.chart.ChartFactory.createBarChart(Unknown Source)
at chartdemo1.doGet(chartdemo1.java:77)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:891)
at com.iplanet.server.http.servlet.WebApplication.service(WebApplication.java:1064)
at com.iplanet.server.http.servlet.NSServletRunner.ServiceWebApp(NSServletRunner.java:953)

==========================================
Guest
 

PreviousNext

Return to JFreeChart

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Yahoo [Bot] and 10 guests