Solved

java servlet & creating wbmp images

Posted on 2000-04-02
6
267 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
  • 3
  • 2
6 Comments
 
LVL 16

Accepted Solution

by:
heyhey_ earned 400 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
network + 7 80
Error with Java/Cache JDBC Classpath 2 31
eclipse formatting 6 73
maven project error 5 48
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now