File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
A. A.
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 580
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try running your JVM in "headless" mode.
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic