ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » NoClassDefFoundError: java.awt.* - WMB V7 Linux

Post new topic  Reply to topic
 NoClassDefFoundError: java.awt.* - WMB V7 Linux « View previous topic :: View next topic » 
Author Message
sourdas2
PostPosted: Tue Nov 19, 2013 3:37 am    Post subject: NoClassDefFoundError: java.awt.* - WMB V7 Linux Reply with quote

Voyager

Joined: 21 Apr 2006
Posts: 90
Location: Kolkata,India

I am using WMB v7.0.0.4.

I have created one static java method and the java method is using java.awt.* classes. I am calling the static java method from ESQL.

Everything works fine when I test the message flow in Windows brokers. When I test the message flow in Linux broker, the following exception is thrown -
Quote:
java.lang.NoClassDefFoundError: java.awt.image.BufferedImage (initialization failure)


The broker configuration and version in Windows and Linux systems are exactly same. Any idea on this?
_________________
Thanks and Warm Regards
Sourav
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
mqjeff
PostPosted: Tue Nov 19, 2013 3:49 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

So you know that AWT stands for "Abstract Window Toolkit", right? That it's a set of classes designed for drawing stuff on a GUI interface.

It's entirely likely that the Unix broker is running under an environment that has no GUI console available to it at all. It's much harder to do that in Windows.

What code are you trying to run in Broker that wants to use AWT?
Back to top
View user's profile Send private message
sourdas2
PostPosted: Tue Nov 19, 2013 4:08 am    Post subject: Reply with quote

Voyager

Joined: 21 Apr 2006
Posts: 90
Location: Kolkata,India

Thanks mqjeff.
I am trying to generate QR Code in base64 encoded format.

Code:
package com.jci.qrcode;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Hashtable;

import javax.imageio.ImageIO;

import sun.misc.BASE64Encoder;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;

public class GenQRCode {
   public static String generate(String codeText) {
      String imageInBase64 = new String();
      int size = 125;
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      
      try   {
         
         Hashtable<EncodeHintType, ErrorCorrectionLevel> hintMap = new Hashtable<EncodeHintType, ErrorCorrectionLevel>();
         hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
         
         QRCodeWriter qrCodeWriter = new QRCodeWriter();
         BitMatrix byteMatrix = qrCodeWriter.encode(codeText,BarcodeFormat.QR_CODE, size, size, hintMap);
         int qrcodeWidth = byteMatrix.getWidth();
         BufferedImage bufImage = new BufferedImage(qrcodeWidth, qrcodeWidth,
               BufferedImage.TYPE_INT_RGB);
         bufImage.createGraphics();
         
         //Create Image
         Graphics2D graphics = (Graphics2D) bufImage.getGraphics();
         graphics.setColor(Color.WHITE);
         graphics.fillRect(0, 0, qrcodeWidth, qrcodeWidth);
         graphics.setColor(Color.BLACK);
         
         for (int i = 0; i < qrcodeWidth; i++) {
            for (int j = 0; j < qrcodeWidth; j++) {
               if (byteMatrix.get(i, j)) {
                  graphics.fillRect(i, j, 1, 1);
               }
            }
         }
         
         //Convert Image into Base64 encode string
         ImageIO.write( bufImage, "bmp", baos );
         byte[] imageInBytes = baos.toByteArray();
         BASE64Encoder encoder = new BASE64Encoder();
         imageInBase64 = encoder.encode(imageInBytes);
         baos.close();
         
      } catch (WriterException e) {
         e.printStackTrace();
      } catch (IOException e) {
         e.printStackTrace();
      }
      
      return imageInBase64;
   }
}

_________________
Thanks and Warm Regards
Sourav
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
stoney
PostPosted: Tue Nov 19, 2013 4:25 am    Post subject: Reply with quote

Centurion

Joined: 03 Apr 2013
Posts: 140

This is a known problem:

http://www-01.ibm.com/support/docview.wss?uid=swg1IC93861
Back to top
View user's profile Send private message
leona313
PostPosted: Thu May 29, 2014 6:58 pm    Post subject: Reply with quote

Newbie

Joined: 29 May 2014
Posts: 2

hey, as for java , i used it to create barcode ,qr code
Back to top
View user's profile Send private message
imageat
PostPosted: Fri May 30, 2014 12:18 am    Post subject: Reply with quote

Newbie

Joined: 30 May 2014
Posts: 2

leona313 wrote:
hey, as for java , i used it to create barcode ,qr code


do you have any detailed tutorial that can share with us. thanks i want to create qr code in java.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » NoClassDefFoundError: java.awt.* - WMB V7 Linux
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.