Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 229193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:44:43+00:00 2026-05-11T19:44:43+00:00

I have an application which is running on tomcat, one of the methods is,

  • 0

I have an application which is running on tomcat, one of the methods is, creating a simple thumbnail from an jpeg image. The functions works fine offline and a week ago also on tomcat. But now i get the following error:

java.lang.NoClassDefFoundError
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:164)
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1141)
eval.impl.ImageEval.getThumbnail(ImageEval.java:155)
eval.impl.ImageServlet.doGet(ImageServlet.java:79)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

I don’t think that i have change anything what should influence this (actually i didn’t change the function at all according to the svn repository), so it must be a library problem. But i can’t figure out what is missing.
Here are the actual lines from the getThumbnail function, where the error occures:

        BufferedImage thumbImage = new BufferedImage(thumbWidth, 
            thumbHeight, BufferedImage.TYPE_INT_RGB);
    Graphics2D graphics2D = thumbImage.createGraphics();
    graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
            RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    graphics2D.drawImage(simage, 0, 0, thumbWidth, thumbHeight, null);

[edit] I decided to update the problem description a little.
Yes it seems that he can not find some class from java.awt or one related to that. But they do exist on the server in the jvm. Java headless mode doesn’t solve the problem.
In another project the exact same code, but inside an axis2 webservice on this server is working fine.
[/edit]

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:44:43+00:00Added an answer on May 11, 2026 at 7:44 pm

    It seems like you’ve change the configuration of Tomcat.

    Either you’ve changed to a l{0,1}[iu]n[iu]x box or installed on a virtual machine with different security control than the one where you test it.

    Apparently the

     GraphicsEnvironment.getLocalGraphicsEnvironment()
    

    Is trying to access the property: java.awt.graphicsenv

    Which may return null or some non existing class name which is then loaded and throws the ClassNotFoundException. 1

    The solution seems to be specifying the “java.awt.headless” property.

    This is a similar question: java.awt.Color error

    Try this search , it shows similar situations as your.

    I remember there was something in the sun bugs database too.

    Post the solution when you find it!

    1.GraphicsEnvironment.java

    EDIT

    It is not eclipse!!

    In my original post there is a link to the source code of the class which is throwing the exception.

    Since I looks like you miss it, I’ll post it here for you:

           public static synchronized GraphicsEnvironment getLocalGraphicsEnvironment() {
              if (localEnv == null) {
                   // Y O U R   E R R O R  O R I G I N A T E S    H E R E !!! 
                  String nm = (String) java.security.AccessController.doPrivileged
                      (new sun.security.action.GetPropertyAction
                       ("java.awt.graphicsenv", null));
    
                  try {
      //                      long t0 = System.currentTimeMillis();
                      localEnv =
                          (GraphicsEnvironment) Class.forName(nm).newInstance();
      //              long t1 = System.currentTimeMillis();
      //              System.out.println("GE creation took " + (t1-t0)+ "ms.");
                      if (isHeadless()) {
                          localEnv = new HeadlessGraphicsEnvironment(localEnv);
                      }
                  } catch (ClassNotFoundException e) {
                      throw new Error("Could not find class: "+nm);
                  } catch (InstantiationException e) {
                      throw new Error("Could not instantiate Graphics Environment: "
                                      + nm);
                  } catch (IllegalAccessException e) {
                      throw new Error ("Could not access Graphics Environment: "
                                       + nm);
                  }
              }
    
              return localEnv;
          }
    

    That’s what gets executed.

    And in the original post which you don’t seem to have read, I said the code is accessing the property “java.awt.graphicsenv”

    If that other project using axis doesn’t have the same problem it may be because it may be running in a different tomcat configuration or the axis library allowed the access to that property. But we cannot be sure. That’s pure speculation. So why don’t you test the following and see what gets printed:

            String nm = (String) java.security.AccessController.doPrivileged
                (new sun.security.action.GetPropertyAction
                 ("java.awt.graphicsenv", null));
    
        System.out.println("java.awt.graphicsenv = " + nm );
    

    It it prints null then you now what the problem is. You don’t have that property in your system, or the security forbids you do use it.

    It is very hard to tell you from here: “Go and edit file xyz and add : fail = false” So you have to do your work and try to figure out what’s the real reason.

    Start by researching what’s the code being executed is ( which I have just posted ) and follow by understand what it does and how does all that “AccessController.doPrivileged” works. (You may use Google + StackOverflow for that).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a simple web Application which is running(on Tomcat Server) fine on
I have a Spring application, which is running on Tomcat say at: http://example.com/foo/ DisplatcherServlet
I have a Java application which is running as non root mode. My App
I have an application in which I am running a separate thread. Dim thread
We have a java application which run as server running on a remote windows
I have a silverlight application which users will be running in various time zones
We have a rather large and complex application written in Java which is running
I am building an application in swt, I also have a thread running which
I have an Java application running in JBoss in which I have enabled JMX
I have a simple servlet running in Tomcat. Because the servlet connects to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.