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 » IBM MQ Java / JMS » java.io.UnsupportedEncodingException: Cp437

Post new topic  Reply to topic
 java.io.UnsupportedEncodingException: Cp437 « View previous topic :: View next topic » 
Author Message
nik_iway
PostPosted: Fri Apr 07, 2006 12:26 am    Post subject: java.io.UnsupportedEncodingException: Cp437 Reply with quote

Centurion

Joined: 21 Jul 2005
Posts: 115

Hi,
I am trying to get the .pdf file from the QUEUEA using the follwing MQGET Program

The Program is Below:


import com.ibm.mq.MQC;
import com.ibm.mq.MQEnvironment;
import com.ibm.mq.MQException;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQGetMessageOptions;
import com.ibm.mq.MQQueue;
import com.ibm.mq.MQQueueManager;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Hashtable;
import java.io.IOException;

public class MQGET
{
public static void main(String args[])
{
MQGET get= new MQGET();
get.MQGET("C:\\qq >");
}
public void getq(String path)
{
String hostName = "10.111.43.16";
System.out.println("Host name is " + hostName);
String channel = "CHAN2";
System.out.println("Channel is " + channel);
String qManager = "TEST";
System.out.println("Qmanager is " + qManager);
String qName = "QUEUEA";
System.out.println("Qname is " + qName);
int portno = 1415;//"Enter the port here as integer";
try
{
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES_CLIENT);
MQEnvironment.hostname = hostName;
MQEnvironment.channel = channel;
MQEnvironment.port = portno;
System.out.println("Setting the qManager connection....");
MQQueueManager qMgr1 = new MQQueueManager(qManager);
System.out.println("Successful in setting the QManager connection");
int openOptions = 33;
MQQueue queue = qMgr1.accessQueue(qName, openOptions, qManager, null, null);
int depth = queue.getCurrentDepth();
if(depth == 0)
return;
MQMessage message = new MQMessage();
MQGetMessageOptions getOptions = new MQGetMessageOptions();
getOptions.options = 8192;
queue.get(message, getOptions);
int fnlen = message.readInt2();
String filename = message.readString(fnlen);
int size = message.readInt4();
byte buffer[] = new byte[size];
message.readFully(buffer, 0, size);
filename = filename + ".pdf";
File fi = new File(path, filename);
FileOutputStream fout = new FileOutputStream(fi);
fout.write(buffer);
fout.close();
}
catch(MQException mqe)
{
mqe.printStackTrace();
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
}
}
---------------------------------------------------------------------------------


I am getting the following error when i am running the java program

**********************************************
Host name is 10.111.43.16
Channel is CHAN2
Qmanager is TEST
Qname is QUEUEA
Setting the qManager connection....
Successful in setting the QManager connection
java.io.UnsupportedEncodingException: Cp437
at sun.io.Converters.getConverterClass(Unknown Source)
at sun.io.Converters.newConverter(Unknown Source)
at sun.io.ByteToCharConverter.getConverter(Unknown Source)
at sun.nio.cs.StreamDecoder$ConverterSD.<init>(Unknown Source)
at sun.nio.cs.StreamDecoder$ConverterSD.<init>(Unknown Source)
at sun.nio.cs.StreamDecoder.forInputStreamReader(Unknown Source)
at java.io.InputStreamReader.<init>(Unknown Source)
at com.ibm.mq.MQMessage.readConvertedString(MQMessage.java:958)
at com.ibm.mq.MQMessage.readString(MQMessage.java:877)
at MQGET.get(MQGET.java:56)
at MQGET.main(MQGET.java:24)
*******************************************************

In my sending application do i need to set the ENCODING values.....

I am running the MQ JAVA API on the same machine as MQServer....

Can you please Explain...........

Regards
Nik
Back to top
View user's profile Send private message
fschofer
PostPosted: Fri Apr 07, 2006 1:15 am    Post subject: Reply with quote

Knight

Joined: 02 Jul 2001
Posts: 524
Location: Mainz, Germany

Hi,

which options are you using here ?

Code:
int openOptions = 33;


Code:
getOptions.options = 8192;


please post the MQC constants like MQC.MQOO_INPUT_AS_Q_DEF

Greetings
Frank
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » java.io.UnsupportedEncodingException: Cp437
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.