This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft 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 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Experts -> Weird Servlet Problem (java.awt.Color)" Watch "Experts -> Weird Servlet Problem (java.awt.Color)" New topic
Author

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

A. A.
Greenhorn

Joined: Apr 05, 2005
Posts: 2
Hello,

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 java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class TestPackages extends HttpServlet {

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

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

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


message

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

exception

javax.servlet.ServletException: Servlet execution threw an exception

root cause

java.lang.NoClassDefFoundError
test.TestPackages.doGet(Unknown Source)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

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.
Aladin
[ April 05, 2005: Message edited by: A. A. ]
A. A.
Greenhorn

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.
Aladin
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
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

"A"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
David O'Meara
Rancher

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.

thanks,
Dave.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Experts -> Weird Servlet Problem (java.awt.Color)
 
Similar Threads
Help with NullPointerException
HTTP Status 500
getServletConfig() does not work
servlet exception occurs at "dispatcher.forward()"
HTTP Status 500 - error running servlet with JSP