Thank you for the reply,
The class in my original post contains the following line:
font = Font.createFont(Font.TRUETYPE_FNT, fis);
This is what causes my application to stall. Another way the error
has come through is as the following:
java.lang.InternalError: Can't connect to X11 window server using
':0.0' as the value of the DISPLAY variable.
(Native Method)
<clinit>()
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:141)
(GraphicsEnvironment.java:62)
java.awt.Font.initializeFont(Font.java:308)
java.awt.Font.<init>(Font.java:353)
java.awt.Font.createFont(Font.java:628)
<init>(Unknown Source)
<clinit>(Unknown Source)
(Unknown Source)
(Unknown Source)
You explanation makes sense. In the link you provided they mention a
better way to catch possible exceptions related to this. Since I
don't have graphics support on my server I must set this option.
Thanks,
Daniel
5/7/05, farhad <fchoupani (AT) comcast (DOT) netwrote:
Look at this link:
#headless
This option is being used when you are operating on a machine without
graphics support (usually in a server configuration). You will use the
option for example when you want to do some AWT/Swing operation on the
server side (image manipulation). You want to check and see if you have
graphics support on your server (on unix/linux run something like xcalc
on the server).
Based on your information, it is your class that has problem and has
nothing to do with graphics.
Daniel Watrous wrote:
>Is there at least someone that could tell me where to find more
>information about the option ""?
>What exactly is its purpose? Thanks in advance.
>
>Daniel
>
5/6/05, Daniel Watrous <dwmaillist (AT) gmail (DOT) comwrote:
>
>
>>Hello,
>>
>>I have a web application that uses java.awt.Font objects to render
>>images. The application will run in tomcat and that is where I have
>>done development. When I first tried to run the application on a
>>Linux box with Tomcat 5.0.25 I got the following error:
>>
>>java.lang.NoClassDefFoundError
>at (Unknown Source)
>at (Unknown Source)
>>
>>Here is the code call that throws the error:
>public String getQuoteFontName() {
>return QuoteFontType.getInstance(this.quoteFontCode).toSt ring();
>}
>>
>>And the class that is being called:
>>/*
>* QuoteFontType.java
>*
>* Created on April 15, 2005, 9:41 AM
>*/
>>
>>package com.words2walls.customquote;
>>
>>import java.awt.Font;
>>import java.awt.FontFormatException;
>>import java.util.*;
>>import java.io.*;
>>
>>import ;
>>
>>/**
>* Type safe enumeration of available fonts
>*
>* @author Daniel Watrous
>*/
>>public class QuoteFontType {
>>
>private static final String pathToWebapp = "C:\\Program
>>Files\\Apache Software Foundation\\Tomcat 5.0\\webapps\\words2walls";
>private static final String pathToPackage =
>>"\\WEB-INF\\classes\\com\\words2walls\\fonts\\";
>private String fontName;
>private int fontCode;
>private Font font;
>private static org.apache.log4j.Category cat =
>(QuoteFontType.class.getName());
>>
>public static final QuoteFontType ADRABLE = new
>>QuoteFontType(1,"Adorable","adorable.ttf");
>private static final Map INSTANCES = new HashMap();
>>
>static {
>cat.debug("Enter Static block to place fonts in INSTANCES Map");
>INSTANCES.put (ADRABLE.toInteger(), ADRABLE);
>cat.debug("Exit Static block with INSTANCES.size() = " +
>>INSTANCES.size());
>}
>>
>/** Creates a new instance of QuoteFontType */
>private QuoteFontType(int code, String fontName, String filename) {
>// create a font from the font file
>try {
>File fontFile = new File ();
>FileInputStream fis = new FileInputStream(fontFile);
>font = Font.createFont(Font.TRUETYPE_FNT, fis);
>} catch (Exception e) {
>throw new FontNotFoundException(e);
>}
>// set member variables
>this.font = font;
>this.fontCode = code;
>this.fontName = fontName;
>}
>>
>public String toString() {
>return fontName;
>}
>>
>public Integer toInteger() {
>return new Integer(fontCode);
>}
>>
>public static QuoteFontType getInstance(int code) {
>return (QuoteFontType) INSTANCES.get(new Integer(code));
>}
>>
>public Font getFont() {
>return font;
>}
>>
>>}
>>
>>After some googling I found that if I set an environment variable
>>"" that this error would go away.
>>I'm not sure why this is the case, but it worked.
>>
>>I am now trying to test the application on a windows machine with
>>Tomcat 5.0.30 and I get the same error. I have set a Windows XP
>>environment variable the same as mentioned above. I have also added
>>the option to the Java tab of the Tomcat monitor under Java :.
>>
>>What is the cause of this error? Is there some way that I can make it
>>work on both Windows and Linux? Thanks in advance.
>>
>>Daniel
>>
>>
>>
>
>
>To unsubscribe, e-mail: tomcat-user-unsubscribe (AT) jakarta (DOT) apache.org
>For additional commands, e-mail: tomcat-user-help (AT) jakarta (DOT) apache.org
>
>
>
>
To unsubscribe, e-mail: tomcat-user-unsubscribe (AT) jakarta (DOT) apache.org
For additional commands, e-mail: tomcat-user-help (AT) jakarta (DOT) apache.org