Help! - upload image in headless mode - server side
We are upgrading java 1.3 to java 1.4 in headless mode on Sun iPlanet.
We have an application in Production which has a servlet to upload the jpeg image into Oracle 8i database(blob) using JSwing and AWK libraries. In 1.3, the servlet is working with JFrame in a 揾eadless?environment, but in 1.4, it throws a java.awt.headless exception.
Here is the code where rises the exception:
=============
public class UploadLocalPicture extends HttpServlet
......
JFrame f = new JFrame();
f.addNotify();
Toolkit tk = Toolkit.getDefaultToolkit();
Image im = tk.createImage(b);
......
==============
What should we do to resolve our issue?
We found below from Sun.com bug database:
====================
Bug ID: 4281163
Release Fixed 1.4(merlin-beta) State Closed, fixed
Description :
Headless Java operation would mean that a server side Java program should be able to use the full J2SE or J2EE API without a GUI environment being present. This means that all AWT calls to manipulate components, graphics, fonts, printing etc. should be functional.
========================
Does this mean that with a properly configured os, the existing web application (server side programs) using AWT and JFC/Swing should work in the headless environment?
Thank you in advance,
Ping
If you describe in more details what exactly it is you're doing on both server sides I will know how to answer your question better.
For example:
Are you reading the jpeg from the disk?
Are you sending bytes through the socket?
What are you doing with the data on the Oracle side?
If you describe in more details what exactly it is you're doing on both server sides I will know how to answer your question better.
For example:
Are you reading the jpeg from the disk?
Are you sending bytes through the socket?
What are you doing with the data on the Oracle side?
Thanks again for the reply.
Are you reading the jpeg from the disk? - yes
Are you sending bytes through the socket? - not sure
What are you doing with the data on the Oracle side? - yes
We have a servlet to read the jpeg from the disk from web user and then stream into the Oracle 8i database(blob). Here are the fragments of the code:
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import java.sql.Blob;
import java.awt.Toolkit;
import java.awt.MediaTracker;
import java.awt.Image;
import java.awt.GraphicsEnvironment;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
?.
public class UploadLocalPicture extends HttpServlet {
厖.
JPanel f = new JPanel();
f.addNotify();
Toolkit tk = Toolkit.getDefaultToolkit();
Image im = tk.createImage(b);
厖
It raised the error at above.
Thank you,
Ping