?
Solved

java servlet & creating wbmp images

Posted on 2000-04-02
6
Medium Priority
?
274 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month9 days, 7 hours left to enroll

762 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