[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

java servlet & creating wbmp images

Posted on 2000-04-02
6
Medium Priority
?
275 Views
Last Modified: 2013-11-24
Hi all!!

I don't know if someone knows the "WBMPcreator". - It is a Java bean for creating WBMP images (=images for wap-devices) automatically and can be found at http://www.netcity.ru/~mkrainov/.


My problem is that it seems that I can't use it together with java-servlets!


* I've took the WBMPcreator-example from
http://www.netcity.ru/~mkrainov/1.05/WBMPStarter.java => that works
* when I create an WBMPfile somewhere in a servlet I get some
"BufferedImage" - Error!!!

=> could someone give me a hint how to make that work???? - And how do I write the WBMP-file into the outputstream??? - with "out.println(file);"
???


thanks!
klaus oberecker


----------
/*
http://www.netcity.ru/~mkrainov/1.05/WBMPStarter.java
... works fine ...
*/
import java.awt.*;
import WBMPcreator.WBMPfile;

public class WBMPStarter {
  private WBMPfile file1;

  public WBMPStarter(){
    Font outFont=new Font("Courier",Font.BOLD,15);
    file1 = new WBMPfile(96,15);
    file1.drawString(" USDJPY",1,11,outFont);
    file1.drawLine(0,0,96,0);
    file1.drawRect(1,1,92,11,false);
    file1.saveWBMP2File("test3.wbmp");
  } // WBMPStarter constructor

  public static void main(String[] args) {
    WBMPStarter wBMPStarter = new WBMPStarter();
  } // main
} // WBMPStarter class

/*

... but placed somewhere in a servlet produces errors:

------ servlet doGet method: ---------
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException{
        res.setHeader("Pragma", "no-cache");
        res.setHeader("Cache-Control", "no-cache");
        res.setDateHeader("Expires", 0);

        res.setContentType("image/vnd.wap.wbmp");
        out=res.getWriter();

    Font outFont=new Font("Courier",Font.BOLD,15);
    file1 = new WBMPfile(96,15);
    file1.drawString(" USDJPY",1,11,outFont);
    file1.drawLine(0,0,96,0);
    file1.drawRect(1,1,92,11,false);
//    file1.saveWBMP2File("test3.wbmp");

        out.println(file1.toString());
        out.close();
}


---- error message ----
reported this exception: java/awt/image/BufferedImage. Please report
this to the administrator of the web server.

     java.lang.NoClassDefFoundError: java/awt/image/BufferedImage at
     WBMPcreator.WBMPfile.prepareRaster(WBMPfile.java:441) at
     WBMPcreator.WBMPfile.text2WBMP(WBMPfile.java:319) at
     WBMPcreator.WBMPfile.drawString(WBMPfile.java:340) at
     myWAPChart.doGet(myWAPChart.java:199) at
     javax.servlet.http.HttpServlet.service(HttpServlet.java:715) at
     javax.servlet.http.HttpServlet.service(HttpServlet.java:840) at
     com.sun.server.ServletState.callService(ServletState.java:226) at
   
com.sun.server.ServletManager.callServletService(ServletManager.java:936)
at
   
com.sun.server.http.servlet.InvokerServlet.service(InvokerServlet.java:137)
at
     javax.servlet.http.HttpServlet.service(HttpServlet.java:840) at
     com.sun.server.ServletState.callService(ServletState.java:226) at
   
com.sun.server.ServletManager.callServletService(ServletManager.java:936)
at
   
com.sun.server.ProcessingState.invokeTargetServlet(ProcessingState.java:423)
at
   
com.sun.server.http.HttpProcessingState.execute(HttpProcessingState.java:79)
at
     com.sun.server.http.stages.Runner.process(Runner.java:79) at
     com.sun.server.ProcessingSupport.process(Compiled Code) at
     com.sun.server.Service.process(Service.java:204) at
   
com.sun.server.http.HttpServiceHandler.handleRequest(HttpServiceHandler.java:374)
at
     com.sun.server.http.HttpServiceHandler.handleRequest(Compiled Code)
at
     com.sun.server.HandlerThread.run(Compiled Code)

*/
0
Comment
Question by:bimpf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 16

Accepted Solution

by:
heyhey_ earned 1600 total points
ID: 2677525
    java.lang.NoClassDefFoundError: java/awt/image/BufferedImage at


java.awt.image.BufferedImage exist in Java 1.2 + but DOES NOT exist in Java 1.1

install the appropriate JDK / JRE
0
 

Author Comment

by:bimpf
ID: 2682466
..hm... I have installed jdk 1.2.1 ... and when I call "java", "javac" or any other java-program jdk 1.2.1 is used ... but obviously the java httpd server from sun doesn't use this jdk

=> do you know if I can tell the sun-javawebserver2.0 which jdk to use??? - obviously not over the classpath variable!


thanks,
klaus
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 2682819
is this Java Web Server ?
better check your docs ... or call the tech support - it's possible that it does not work under 1.2 at all ... (I've never used it personally)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Expert Comment

by:mkrainov
ID: 2682823
It's simple.  The version you use doesn't support putting the WBMPfile instance to the stream. The last version (1.11) after 03.04.2000 supports any feature you need.
0
 

Author Comment

by:bimpf
ID: 2683147
.. I've now changed my Java Web Server - settings in order to use jdk 1.2.1 ... I havn't tried version 1.11 yet  because everything works now and I'm under time-pressure

=>
if you want to get the points "heyhey" you have to place another comment so I can grade your answer ..

.... if you don't reply I'm giving the points to mkrainov because his WBMPCreator is a very useful and great utility ..

thanks to you both!
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 2683225
if you want to give me the points, I suppose that you'll have to reject the current answer ... (btw. the real problem was JDK version, not the WBMPfile version)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question