|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
NoClassDefFoundError: java.awt.* - WMB V7 Linux |
« View previous topic :: View next topic » |
Author |
Message
|
sourdas2 |
Posted: Tue Nov 19, 2013 3:37 am Post subject: NoClassDefFoundError: java.awt.* - WMB V7 Linux |
|
|
 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 |
|
 |
mqjeff |
Posted: Tue Nov 19, 2013 3:49 am Post subject: |
|
|
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 |
|
 |
sourdas2 |
Posted: Tue Nov 19, 2013 4:08 am Post subject: |
|
|
 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 |
|
 |
stoney |
Posted: Tue Nov 19, 2013 4:25 am Post subject: |
|
|
Centurion
Joined: 03 Apr 2013 Posts: 140
|
|
Back to top |
|
 |
leona313 |
Posted: Thu May 29, 2014 6:58 pm Post subject: |
|
|
Newbie
Joined: 29 May 2014 Posts: 2
|
|
Back to top |
|
 |
imageat |
Posted: Fri May 30, 2014 12:18 am Post subject: |
|
|
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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|