BM MQ error

S

Selami Ozlu

Hi,
when i try to connect to IBM MQ manager, i get the following error

An unhandled exception of type 'System.NullReferenceException'
occurred in
Unknown Module.


Additional information: Object reference not set to an instance of an
object.


Here is my code:
Regards, Selami Ozlu selamiozlu


Try
If mChannel <> "" Then
mqQMgr = New MQQueueManager(mManagerName, channelName,
connectionName)
ElseIf mManagerName <> "" Then
mqQMgr = New MQQueueManager(mManagerName)
Else
mqQMgr = New MQQueueManager
End If
Catch ex As Exception
Throw New Exception("Manager failed: " & ex.Message)
End Try
 
L

Lasse Vågsæther Karlsen

Selami said:
Hi,
when i try to connect to IBM MQ manager, i get the following error

An unhandled exception of type 'System.NullReferenceException'
occurred in
Unknown Module.


Additional information: Object reference not set to an instance of an
object.


Here is my code:
Regards, Selami Ozlu selamiozlu


Try
If mChannel <> "" Then
mqQMgr = New MQQueueManager(mManagerName, channelName,
connectionName)
ElseIf mManagerName <> "" Then
mqQMgr = New MQQueueManager(mManagerName)
Else
mqQMgr = New MQQueueManager
End If
Catch ex As Exception
Throw New Exception("Manager failed: " & ex.Message)
End Try

First of all, the code as shown does not have any obvious references to
null values so there's no way for us to know what in particular could be
wrong, of if it is even this piece of code. Have you tried debugging to
see which line in the above piece of code that fails with the error, and
have you made sure that none of the variables in the code are null?

Second, I'd vaguer not that many people here have access to or is used
to dealing with the IBM MQ system, so you might need to go ask the
question on a newsgroup or discussion forum related to that product.

Lastly, the code as shown is VB.NET, not C#, and although I suspect your
question doesn't really have anything to do with the language, you might
also get more appropriate answers in a VB newsgroup.

Sorry that I can't be much of a help, but I suspect nobody can with the
provided information.
 
S

Selami Ozlu

First of all, the code as shown does not have any obvious references to
null values so there's no way for us to know what in particular could be
wrong, of if it is even this piece of code. Have you tried debugging to
see which line in the above piece of code that fails with the error, and
have you made sure that none of the variables in the code are null?

Second, I'd vaguer not that many people here have access to or is used
to dealing with the IBM MQ system, so you might need to go ask the
question on a newsgroup or discussion forum related to that product.

Lastly, the code as shown is VB.NET, not C#, and although I suspect your
question doesn't really have anything to do with the language, you might
also get more appropriate answers in a VB newsgroup.

Sorry that I can't be much of a help, but I suspect nobody can with the
provided information.

--
Lasse Vågsæther Karlsen
mailto:[email protected]://presentationmode.blogspot.com/- Hide quotedtext -

- Show quoted text -

Hi Lasse,
the line that seems it causes the problem:
mqQMgr = New MQQueueManager(mManagerName, channelName, connectionName)

yes, i know it is not C# problem althouhg i use bv and C# together.

Thank you
Selami Ozlu selamiozlu
 
S

Selami Ozlu

Hi Lasse,
the line that seems it causes the problem:
mqQMgr = New MQQueueManager(mManagerName, channelName, connectionName)

yes, i know it is not C# problem althouhg i use bv and C# together.

Thank you
Selami Ozlu selamiozlu- Hide quoted text -

- Show quoted text -

Hi,
Currently I have been working on a project sending a file with
certfication and signature (the application is running on Windows
2003
Server Standard Edition) to IBM MQ server via IBM Websphere MQ
windows
client v6.0.
And I get the followoing error message when I debug my application :

"An unhandled exception of type 'System.NullReferenceException'
occurred in Unknown Module.


Additional information: Object reference not set to an instance of an
object."


When I do connect to MQ server on DOS by using put messages and get
messages, no problem with connections.


IS this a known bug ? IS there any fix patch or refresh patch?


IS this may be a memory problem?
I cannot clearly debug my application.


Any help will be appriciated.


Some of my code that may give a light:


Dim fs As FileStream
Dim sr As StreamReader
Dim sw As StreamWriter
Dim hexString As String = ""
Dim sb As StringBuilder
Dim i As Integer
Dim xmlBuffer As String
Dim key As String
Dim mq As MQClient ' SO 12/11/07
Dim objXMLdocument As XmlDocument


Try
fs = New FileStream(inFile, FileMode.Open,
FileAccess.Read)
Dim fileLen As Integer = fs.Length
Dim byteBuffer(fileLen - 1) As Byte
fs.Read(byteBuffer, 0, fileLen)
fs.Close()
sb = New StringBuilder
For i = 0 To byteBuffer.Length - 1
If byteBuffer(i) < 16 Then
sb.Append("0" & Hex(byteBuffer(i)))
Else
sb.Append(Hex(byteBuffer(i)))
End If
Next
hexString = sb.ToString
If File.Exists(mqXmlTemplate) Then
fs = New FileStream(mqXmlTemplate, FileMode.Open,
FileAccess.Read)
sr = New StreamReader(fs,
System.Text.Encoding.Default)
xmlBuffer = sr.ReadToEnd
sr.Close()
fs.Close()
For Each key In XMLParams.Keys
xmlBuffer = xmlBuffer.Replace("{" & key & "}",
XMLParams(key))
Next
xmlBuffer = xmlBuffer.Replace("{Body}", hexString)
If xmlBuffer.IndexOf(signatureMask) Then
'objXMLdocument = New XmlDocument
'objXMLdocument.LoadXml(xmlBuffer)
'Dim ndl As XmlNodeList =
objXMLdocument.GetElementsByTagName(signatureMask.Replace("{",
"").Replace("}", ""))
'If Not ndl Is Nothing AndAlso ndl.Count = 1 Then
' Dim pnd As XmlNode = ndl.Item(0).ParentNode
' Dim nd As XmlNode =
pnd.SelectSingleNode("Signature")
' pnd.RemoveChild(nd)
' Dim xmlMessage As String = pnd.OuterXml
' Dim xmlSignature As String =
SignXmlNode(xmlMessage)
' i = xmlBuffer.IndexOf(signatureMask)
' xmlBuffer = xmlBuffer.Substring(0, i) &
xmlSignature & xmlBuffer.Substring(i + signatureMask.Length)
'End If
objXMLdocument = New XmlDocument
objXMLdocument.LoadXml(xmlBuffer)
Dim strPath As String =
GetXMLPath(objXMLdocument,
signatureMask.Replace("{", "").Replace("}", ""))
If strPath = "" Then
Throw New Exception("Invalid MQXML template")
End If
Call DeleteLine(xmlBuffer,
xmlBuffer.IndexOf(signatureMask), lineSepChars)
Call SignXml(xmlBuffer, strPath)
End If
If DebugFlag Then
objXMLdocument = New XmlDocument
Dim tw As New
XmlTextWriter(inFile.Replace(".pdf",
".xml"), New System.Text.UTF8Encoding(True))
objXMLdocument.LoadXml(xmlBuffer)
objXMLdocument.WriteTo(tw)
tw.Close()
tw = Nothing
End If
Else
xmlBuffer = hexString
End If
If Not MQParams Is Nothing AndAlso MQParams.Keys.Count >
0
Then
If MQParams.Contains("QNAME") Then
mqQueue = MQParams("QNAME")
End If
If MQParams.Contains("MANAGER") Then
mqManager = MQParams("MANAGER")
End If
If MQParams.Contains("CHANNEL") Then
mqChannel = MQParams("CHANNEL")
End If
mqMessagePersitence = True
If MQParams.Contains("PERSISTENCE") Then
If MQParams("PERSISTENCE") <> "Y" Then
mqMessagePersitence = False
End If
End If
'Dim mq As MQClient ' SO 12/11/07
mq = Nothing ' SO 12/11/07
mq = New MQClient(mqChannel, mqManager, mqQueue,
xmlBuffer)
'SO mq = New MQClient("SYSTEM.DEF.SVRCONN/TCP/
182.188.888.889(1414)", "TEST", "LOCAL.QUEUE.TEST.TTT.QUEUE",
"SELAMIOZLU")
'mq.MessagePersitence = mqMessagePersitence
mq.CreateManager()
mq.CreateQueuePut()
mq.PutMessage()
'SO mq.GetMessage()
'SO MessageBox.Show("Message=" & mq.MessageString)
mq.Close()
End If
Catch ex As Exception
Throw New Exception("MQ-XML Error: " & ex.Message)
Finally
.
.
.
.
.
Regards.
Selami Ozlu.




Reply Reply to author Forward







You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before
posting.
You do not have the permission required to post.



Selami Ozlu View profile
More options Dec 11, 4:00 pm

Newsgroups: ibm.software.websphere.application-server
From: Selami Ozlu <[email protected]>
Date: Tue, 11 Dec 2007 13:00:32 -0800 (PST)
Local: Tues, Dec 11 2007 4:00 pm
Subject: Re: via IBM Websphere MQ windows client v6.0
Reply | Reply to author | Forward | Print | Individual message | Show
original | Remove | Report this message | Find messages by this
author



- Hide quoted text -
- Show quoted text -
Hi,
Currently I have been working on a project sending a file with
certfication and signature (the application is running on Windows
2003
Server Standard Edition) to IBM MQ server via IBM Websphere MQ
windows
client v6.0.
And I get the followoing error message when I debug my application :
"An unhandled exception of type 'System.NullReferenceException'
occurred in Unknown Module.

Additional information: Object reference not set to an instance of an
object."

When I do connect to MQ server on DOS by using put messages and get
messages, no problem with connections.

IS this a known bug ? IS there any fix patch or refresh patch?

IS this may be a memory problem?
I cannot clearly debug my application.

Any help will be appriciated.

Some of my code that may give a light:

Dim fs As FileStream
Dim sr As StreamReader
Dim sw As StreamWriter
Dim hexString As String = ""
Dim sb As StringBuilder
Dim i As Integer
Dim xmlBuffer As String
Dim key As String
Dim mq As MQClient ' SO 12/11/07
Dim objXMLdocument As XmlDocument

Try
fs = New FileStream(inFile, FileMode.Open,
FileAccess.Read)
Dim fileLen As Integer = fs.Length
Dim byteBuffer(fileLen - 1) As Byte
fs.Read(byteBuffer, 0, fileLen)
fs.Close()
sb = New StringBuilder
For i = 0 To byteBuffer.Length - 1
If byteBuffer(i) < 16 Then
sb.Append("0" & Hex(byteBuffer(i)))
Else
sb.Append(Hex(byteBuffer(i)))
End If
Next
hexString = sb.ToString
If File.Exists(mqXmlTemplate) Then
fs = New FileStream(mqXmlTemplate, FileMode.Open,
FileAccess.Read)
sr = New StreamReader(fs,
System.Text.Encoding.Default)
xmlBuffer = sr.ReadToEnd
sr.Close()
fs.Close()
For Each key In XMLParams.Keys
xmlBuffer = xmlBuffer.Replace("{" & key & "}",
XMLParams(key))
Next
xmlBuffer = xmlBuffer.Replace("{Body}", hexString)
If xmlBuffer.IndexOf(signatureMask) Then
'objXMLdocument = New XmlDocument
'objXMLdocument.LoadXml(xmlBuffer)
'Dim ndl As XmlNodeList =
objXMLdocument.GetElementsByTagName(signatureMask.Replace("{",
"").Replace("}", ""))
'If Not ndl Is Nothing AndAlso ndl.Count = 1 Then
' Dim pnd As XmlNode = ndl.Item(0).ParentNode
' Dim nd As XmlNode =
pnd.SelectSingleNode("Signature")
' pnd.RemoveChild(nd)
' Dim xmlMessage As String = pnd.OuterXml
' Dim xmlSignature As String =
SignXmlNode(xmlMessage)
' i = xmlBuffer.IndexOf(signatureMask)
' xmlBuffer = xmlBuffer.Substring(0, i) &
xmlSignature & xmlBuffer.Substring(i + signatureMask.Length)
'End If
objXMLdocument = New XmlDocument
objXMLdocument.LoadXml(xmlBuffer)
Dim strPath As String =
GetXMLPath(objXMLdocument,
signatureMask.Replace("{", "").Replace("}", ""))
If strPath = "" Then
Throw New Exception("Invalid MQXML template")
End If
Call DeleteLine(xmlBuffer,
xmlBuffer.IndexOf(signatureMask), lineSepChars)
Call SignXml(xmlBuffer, strPath)
End If
If DebugFlag Then
objXMLdocument = New XmlDocument
Dim tw As New
XmlTextWriter(inFile.Replace(".pdf",
".xml"), New System.Text.UTF8Encoding(True))
objXMLdocument.LoadXml(xmlBuffer)
objXMLdocument.WriteTo(tw)
tw.Close()
tw = Nothing
End If
Else
xmlBuffer = hexString
End If
If Not MQParams Is Nothing AndAlso MQParams.Keys.Count >
0
Then
If MQParams.Contains("QNAME") Then
mqQueue = MQParams("QNAME")
End If
If MQParams.Contains("MANAGER") Then
mqManager = MQParams("MANAGER")
End If
If MQParams.Contains("CHANNEL") Then
mqChannel = MQParams("CHANNEL")
End If
mqMessagePersitence = True
If MQParams.Contains("PERSISTENCE") Then
If MQParams("PERSISTENCE") <> "Y" Then
mqMessagePersitence = False
End If
End If
'Dim mq As MQClient ' SO 12/11/07
mq = Nothing ' SO 12/11/07
mq = New MQClient(mqChannel, mqManager, mqQueue,
xmlBuffer)
'SO mq = New MQClient("SYSTEM.DEF.SVRCONN/TCP/
182.188.888.889(1414)", "TEST", "LOCAL.QUEUE.TEST.TTT.QUEUE",
"SELAMIOZLU")
'mq.MessagePersitence = mqMessagePersitence
mq.CreateManager()
mq.CreateQueuePut()
mq.PutMessage()
'SO mq.GetMessage()
'SO MessageBox.Show("Message=" & mq.MessageString)
mq.Close()
End If
Catch ex As Exception
Throw New Exception("MQ-XML Error: " & ex.Message)
Finally
.
.
.
.
.
Regards.
Selami Ozlu.



Hi,
the error message details :

?ex.GetBaseException
{System.NullReferenceException}
[System.NullReferenceException]: {System.NullReferenceException}
HelpLink: Nothing
InnerException: Nothing
Message: "Object reference not set to an instance of an object."
Source: "amqmdxcs"
StackTrace: " at IBM.WMQ.MQBaseObject.TrExit(UInt32 method,
Int32 retCode)
at IBM.WMQ.MQQueueManager.Connect(String queueManagerName)
at IBM.WMQ.MQQueueManager..ctor(String queueManagerName, String
Channel, String ConnName)
at IPSATP.MQClient.CreateManager() in D:\WORK_SO\IPSATP
\MQClient.vb:line 48"
TargetSite: {System.Reflection.RuntimeMethodInfo}


Regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top