You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Wentink, Marc" <m....@antoniusmesosgroep.nl> on 2006/02/22 16:41:34 UTC

Image files accesable for a servlet in Tomcat, but they were accesible in Java standalone program

Dear Sirs,

I have got a servlet that generates a pdf file from a xml file, the servlet runs in Tomcat, and it runs fine as long as in the xml file does not contain references to images. At the moment the xml contains an image I got this error:

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 net.antonius.pdfgen.TypeImageMap.parse(Unknown Source)


The strange thing is that if I ran the old program as an independent java program, I did not got the error. Hence the java environment provided by Tomcat misses some classes?

Thanks in advance for any suggestions.

Marc 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Image files accesable for a servlet in Tomcat, but they were accesible in Java standalone program

Posted by Vinu Varghese <vi...@x-minds.org>.
Add this to the CATALINA_OPTS

-Djava.awt.headless=true

in your catalina.sh

Wentink, Marc wrote:

>Dear Sirs,
>
>I have got a servlet that generates a pdf file from a xml file, the servlet runs in Tomcat, and it runs fine as long as in the xml file does not contain references to images. At the moment the xml contains an image I got this error:
>
>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 net.antonius.pdfgen.TypeImageMap.parse(Unknown Source)
>
>
>The strange thing is that if I ran the old program as an independent java program, I did not got the error. Hence the java environment provided by Tomcat misses some classes?
>
>Thanks in advance for any suggestions.
>
>Marc 
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>  
>

-- 
........................................

Vinu Varghese
vinu@x-minds.org
www.x-minds.org


RE: Image files accesable for a servlet in Tomcat, but they were accesible in Java standalone program

Posted by Paul Hamer <pa...@tohave.nl>.
Hi Marc,

Are you running Tomcat on a "headless" machine, in other words, on a machine
that does not have any graphics drivers installed? This is the case for many
SSH-only Linux servers, like mine.

If so, then specify

-Djava.awt.headless=true 

as a parameter to Tomcat.

Regards,
Paul Hamer

management & development
paul@tohave.nl

toHAVE websolutions
www.tohave.nl
info@tohave.nl 

> -----Original Message-----
> From: Wentink, Marc [mailto:m.wentink@antoniusmesosgroep.nl] 
> Sent: Wednesday, 22 February, 2006 16:42
> To: tomcat-user@jakarta.apache.org
> Subject: Image files accesable for a servlet in Tomcat, but 
> they were accesible in Java standalone program
> 
> Dear Sirs,
> 
> I have got a servlet that generates a pdf file from a xml 
> file, the servlet runs in Tomcat, and it runs fine as long as 
> in the xml file does not contain references to images. At the 
> moment the xml contains an image I got this error:
> 
> java.lang.NoClassDefFoundError
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:141)
>         at 
> java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(Graph
> icsEnvironment.java:62)
>         at 
> java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1041)
>         at 
> java.awt.image.BufferedImage.getGraphics(BufferedImage.java:1031)
>         at net.antonius.pdfgen.TypeImageMap.parse(Unknown Source)
> 
> 
> The strange thing is that if I ran the old program as an 
> independent java program, I did not got the error. Hence the 
> java environment provided by Tomcat misses some classes?
> 
> Thanks in advance for any suggestions.
> 
> Marc 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org