This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Servlets and the fly likes Experts -> Weird Servlet Problem (java.awt.Color) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Experts -> Weird Servlet Problem (java.awt.Color)" Watch "Experts -> Weird Servlet Problem (java.awt.Color)" New topic

Experts -> Weird Servlet Problem (java.awt.Color)

A. A.

Joined: Apr 05, 2005
Posts: 2

I am experiencing a VERY strange problem with my seemingly simple servlet. Whenever I try to instantiate a Color object from my servlet I get an error. When I comment out the instantiation line, the servlet works fine.

Here is the code and the error:

package aladin;

import java.awt.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class TestPackages extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {

PrintWriter out = response.getWriter();
out.println("Test Packages servlet.<BR>");

Color color = new Color(0,0,0);


description The server encountered an internal error () that prevented it from fulfilling this request.


javax.servlet.ServletException: Servlet execution threw an exception

root cause

test.TestPackages.doGet(Unknown Source)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.7 logs.

Any ideas??? I am running java 5 with tomcat 5.5.7

Thanks in advance.
[ April 05, 2005: Message edited by: A. A. ]
A. A.

Joined: Apr 05, 2005
Posts: 2
I figured it out.

The process could not open a shared library... which java.awt.Color requires.

Talk about headaches.

Thanks anyway.
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
Try running your JVM in "headless" mode.

James Carman, President<br />Carman Consulting, Inc.
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it


Thanks! and welcome to the JavaRanch!


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

"A. A.",
please try harder to comply with the naming convention. We Require display names to be two words: your first name, a space, then your last name.

Accounts with invalid display names get deleted.

I agree. Here's the link:
subject: Experts -> Weird Servlet Problem (java.awt.Color)
It's not a secret anymore!