• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reading a serialized object, Tomcat

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

I seem to have a problem with my JSP application running on Apache Tomcat/6.0.14.

I catch the following exception:
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit

This happens when I tried to read in a file containing a serialized object.


The class of the object, which is being red, contains an instance of a Swing class ImageIcon. This works fine on GlassFish on my machine, but gives an error when uploaded to Tomcat.

I'd welcome any suggestions how to read in the serialized object.

Dominik
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The server you are running on is a *nix type?
Most probably without a monitor?
Check out headless mode to see if it might help: http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/

I'm not sure if it will or not. The sun.* classes are not really intended for general use
Can you come up with a better approach than serializing java objects?
 
Dominik Glodzik
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey,

thank you VERY much, it works.

Yes, the server runs Linux with no display.

To switch Tomcat to a headless mode, add the following line to catalina.sh
export CATALINA_OPTS=-Djava.awt.headless=true

Dominik


 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic