aspose file tools*
The moose likes Servlets and the fly likes show buffered image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "show buffered image" Watch "show buffered image" New topic
Author

show buffered image

matthias maneck
Greenhorn

Joined: Jun 28, 2004
Posts: 2
hi,
i create a buffered im age with the help of a servlet and show it on a jsp.

i have installed jdk 1.4.2 and tomcat 4.1 under windows...

if i run the web-application with the tomcat serven on my system everything is fine.

if i run it ou an external server tomcat 4.1 with jre 1.4.2_02 und er linux
the following error occurs when the image should appear:

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 gelcali.DrawGel.doGet(DrawGel.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

why???
is it not possible to run the server under linux with jre and show buffered images?

thanks
matthias

p.s.: i create the buffered image by the following way:

BufferedImage image = new BufferedImage(450, 450,
BufferedImage.TYPE_INT_RGB);

DrawGel line 70 --> Graphics2D graphic = image.createGraphics();
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Many of the operations in the java.awt package rely on native support - ie they tie into the underlying operating system. I've run into this problem before where the linux installation doesn't have any graphics support (ie 'headless'), typically with the error "Can't connect to X11 window server"

But there is a work around - here is an api called PJA (Pure Java AWT) which implements the required graphics support with a purely Java implementation. I still had some problems that I didn't end up fixing - like using Fonts - but all I was doing was simple graphics conversion, and this worked fine.

Hope this is what you were looking for.

Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: show buffered image