• Post Reply Bookmark Topic Watch Topic
  • New Topic

batik SVG object gets: Gtk-WARNING **: cannot open display  RSS feed

Paul Fenerty
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am developing a servlet running under tomcat.

All was working fine (tomcat serves JSP form to Mozilla Firefox, form data inserted back into mySQL, all processes running on local machine) until I restarted tomcat with the webapp rebuilt with a batik SVG object. Now, the servlet runs, but the form never loads, and this message appears in catalina.out:

"Gtk-WARNING **: cannot open display:"

The JSP that fails attempts to instantiate a javabean, which now (this build) attempts to instantiate the batik SVG object.

Just before running into this error, I received the following error, for the same build, in (log4j's) tomcat.log:

java.lang.ClassNotFoundException: org.w3c.dom.svg.SVGDocument

... this error was encountered as the JSP instantiated the bean, and was fixed by providing the following links in $CATALINA_HOME/common/lib/

xml-apis-ext.jar -> /opt/batik/batik-1.7/lib/xml-apis-ext.jar
batik-svg-dom.jar -> /opt/batik/batik-1.7/lib/batik-svg-dom.jar
batik-util.jar -> /opt/batik/batik-1.7/lib/batik-util.jar
batik-awt-util.jar -> /opt/batik/batik-1.7/lib/batik-awt-util.jar
batik-svggen.jar -> /opt/batik/batik-1.7/lib/batik-svggen.jar
batik-dom.jar -> /opt/batik/batik-1.7/lib/batik-dom.jar

Here's the relevant code in the SVG object:

import org.apache.batik.dom.svg.SVGDOMImplementation;
import org.apache.batik.svggen.SVGGraphics2D;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.svg.SVGDocument;

private SVGGraphics2D svggen;
private DOMImplementation dom;
private SVGDocument doc;

... in the constructor:

dom = SVGDOMImplementation.getDOMImplementation();
doc = (SVGDocument) dom.createDocument(null, "svg", null);
svggen = new SVGGraphics2D(doc);

I successfully run this same object in a standalone version (java swing) of this webapp on this PC. The SVG enabled Firefox browser (adobesvg-3.01-linux-i386) successfully loads the SVG images this application produces.

Regarding possible Xserver issues, i'm logged in as me, and start/stop tomcat by way of 'sudo /sbin/service'. The links to the batik jars, and the jars themselves, are owned by user 'tomcat'. I have other tomcat webapps on this box, and they run fine ... this must be some sort of unhappiness about SVG, n'est-ce pas?



- Linux 2.6.17-1.2174_FC5 (Fedora Core 5)
- tomcat5-5.5.15-1jpp_6fc
- jdk1.5.0_08
- Mozilla/5.0 (X11; U; Linux i686; en-US; rv:
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!