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 IndexIBM MQ Java / JMSError en MQQueueManager

Post new topicReply to topic
Error en MQQueueManager View previous topic :: View next topic
Author Message
TRANSPORTATOR
PostPosted: Thu Jun 22, 2006 5:34 am Post subject: Error en MQQueueManager Reply with quote

Apprentice

Joined: 04 May 2006
Posts: 27

Please they can help me,

each you see that I execute the MQSample code leaves an error to me “has not been the source” qMgr = new MQQueueManager (qManager). that it can be this error, I have haberiguado the bookstores but it even follows in the same



import java.io.IOException;
import com.ibm.mq.*;

public class MQSamp {

// Define el nombre del Gestor de Cola
private String qManager = "JAVAMQM";
// Define el Gestor de Cola
private MQQueueManager qMgr;

/** ********************** */
/** Cuerpo del Programa * */
/** ********************** */

// Cuando se llama la clase, esta inicialización se hace primero.

public static void main(String args[])
{
new MQSamp();
} // End of init

public MQSamp()
{
try {
/** CONEXION * */
// Crea una conexion con el Gestor de Cola
qMgr = new MQQueueManager(qManager);

/** ABRIR * */
// Configura las opciones en la cola que se va abrir
// ** Todas las opciones de MQSeries tiene un prefijo MQC de
// java
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT ;

// Especificar la cola que se va abrir con sus opciones
MQQueue system_defaul_local_queue = qMgr.accessQueue("SYSTEM_DEFAULT_LOCAL_QUEUE", openOptions);

// Definir un mensaje que se va insertar en la cola, en formato
// UTF
MQMessage hola = new MQMessage();
hola.writeUTF(" Hola Sres.");
System.out.println("prueba 1");

// Especificar las opciones del mensaje
MQPutMessageOptions pmo = new MQPutMessageOptions();

// Transferir el mensaje a la cola
system_defaul_local_queue.put(hola,pmo);

// Obtener el nuevo mensaje
// Definir primero un almacenamiento intermedio de mensaje
// MQSeries para recibir el mensaje
MQMessage retrievedMessage = new MQMessage();
retrievedMessage.messageId = hola.messageId;

// Establecer las opciones de optecion del mensaje
MQGetMessageOptions gmo = new MQGetMessageOptions();

// Extraer el mensaje de la cola
system_defaul_local_queue.get(retrievedMessage,gmo);

// Probar que tenemos el mensaje visualizado UTF
String msgText = retrievedMessage.readUTF();
System.out.print(" El mensaje es : " + msgText);

// Cerrar la cola
system_defaul_local_queue.close();

// Desconectar el Gestor de Cola
qMgr.disconnect();
}
// Si se a producido un error mas arriba, idenfificar el error
catch (MQException ex)
{
System.out.print(" Se a producido un error MQSeries : Codigo de terminacion " +
ex.completionCode + "Codigo Razon " + ex.reasonCode);
}
catch (IOException ex)
{
System.out.print(" Se a producido un error al grabar el mensaje:" + ex );
}
}
} // FIN DEL PROGRAMA
Back to top
View user's profile Send private message MSN Messenger
8davitt
PostPosted: Tue Jun 27, 2006 2:06 am Post subject: Reply with quote

Apprentice

Joined: 06 Feb 2003
Posts: 37
Location: Seated in front of monitor

I do not understand your question.

However I used your source code and I modified one line:

MQQueue system_defaul_local_queue = qMgr.accessQueue("SYSTEM.DEFAULT.LOCAL.QUEUE", openOptions);

to correct the name of the default local queue and the program works fine.

If you have problems then include the MQ Java tracing and provide details of any error message that you see.

To include trace:
:
import java.io.*;
:
:
try {
FileOutputStream tf = new FileOutputStream("MQSamp.trc");
MQEnvironment.enableTracing(5,tf);
}
catch (IOException e) {
MQEnvironment.enableTracing(5);
}



/s
Back to top
View user's profile Send private message
TRANSPORTATOR
PostPosted: Tue Jun 27, 2006 9:13 am Post subject: Reply with quote

Apprentice

Joined: 04 May 2006
Posts: 27

Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
at MQApplet.SendMsg(MQApplet.java:195)
at MQApplet.actionPerformed(MQApplet.java:153)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Back to top
View user's profile Send private message MSN Messenger
wschutz
PostPosted: Tue Jun 27, 2006 9:30 am Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

TRANSPORTATOR wrote:
Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
at MQApplet.SendMsg(MQApplet.java:195)
at MQApplet.actionPerformed(MQApplet.java:153)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Did you really mean to post this? How does it relate to your program MQSamp?
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
8davitt
PostPosted: Wed Jun 28, 2006 3:38 am Post subject: Reply with quote

Apprentice

Joined: 06 Feb 2003
Posts: 37
Location: Seated in front of monitor

Hello TRANSPORTATOR,

Your java.lang.NullPointerException in the Applet application appears to be completely unrelated to the MQSamp.java program that you posted.

I think you should provide information about
o what application you are running
o how you are executing the code
o details of the Java source code that is causing the problem

You can also try adding the trace code to your applet source code.

/s
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ Java / JMSError en MQQueueManager
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.