Author |
Message
|
TRANSPORTATOR |
Posted: Thu Jun 22, 2006 5:34 am Post subject: Error en MQQueueManager |
|
|
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 |
|
 |
8davitt |
Posted: Tue Jun 27, 2006 2:06 am Post subject: |
|
|
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 |
|
 |
TRANSPORTATOR |
Posted: Tue Jun 27, 2006 9:13 am Post subject: |
|
|
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 |
|
 |
wschutz |
Posted: Tue Jun 27, 2006 9:30 am Post subject: |
|
|
 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 |
|
 |
8davitt |
Posted: Wed Jun 28, 2006 3:38 am Post subject: |
|
|
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 |
|
 |
|