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 » MQJE038: Unexpected segment type 156 received

Post new topic  Reply to topic
 MQJE038: Unexpected segment type 156 received « View previous topic :: View next topic » 
Author Message
naylorjs
PostPosted: Fri Nov 26, 2004 4:20 am    Post subject: MQJE038: Unexpected segment type 156 received Reply with quote

Novice

Joined: 26 Nov 2004
Posts: 10

Hi

I'm an application programmer using the raw WMQ Java classes. I have a simple class to send message to our server, my work is very mich based on the examples supplied by IBM.

When the program is run I get the following output. If anyone wants any more details then I can provide the results of running again with the trace level set to whatever level you like.

MQJE001: An MQException occurred: Completion Code 2, Reason 2195
MQJE038: Unexpected segment type 156 received
MQJE001: Completion Code 2, Reason 2195
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2195
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:172)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:270)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:290)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:80)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:150)
at com.ibm.mq.MQQueueManager.obtainBaseMQQueueManager(MQQueueManager.java:682)
at com.ibm.mq.MQQueueManager.construct(MQQueueManager.java:620)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:393)
at be.post.queuer.MQSender.open(MQSender.java:47)
at be.post.queuer.Queuer.run(Queuer.java:116)
at be.post.queuer.Queuer.main(Queuer.java:44)

Unfortunately searches via Google or on the IBM site have failed to provide any information on MQJE038 or on anything else that is useful to me.

I am not an expert on WMQ, although I am a very experienced developer, but this one has me completely stumped. Can anyone help in any way ?

The equivalent C program, which I am replacing has no problems whatsoever apart from being unreadable

Any help would be appreciated.

Jonathan
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Nov 26, 2004 4:40 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Well, MQ Reason Code 2195 is "Unexpected error".

The manual says to check the code for missing parameters and etc., so please post your code.

It also says to check for FDCs being thrown. So please have your MQ Administrator check for FDCs that may have been thrown at the same time as you ran your code.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
naylorjs
PostPosted: Fri Nov 26, 2004 4:43 am    Post subject: Reply with quote

Novice

Joined: 26 Nov 2004
Posts: 10

I though the MQJE038 was actually more significant to be honest

However here is the full class.

/*
* This is a wrapper class around the Websphere MQ classes to provide a simple
* and relatively inflexible interface to send messages. However flexibility
* is not needed so there is no loss.
*
* Jonathan Naylor 22.11.2004
*/

package be.post.queuer;

import java.lang.*;
import java.io.*;

import com.ibm.mq.*;

public class MQSender implements Sender
{
private MQQueueManager manager = null;
private MQQueue queue = null;

private int bytesSent = 0;
private int messagesSent = 0;

private OutputStream stream = null;
private String fileName = null;
private int traceLevel = 0;

public MQSender()
{
fileName = QueuerProperties.getTraceFileName();

// Set the environment from the properties file
MQEnvironment.hostname = QueuerProperties.getHost();
MQEnvironment.channel = QueuerProperties.getChannel();
MQEnvironment.port = QueuerProperties.getPort();

traceLevel = QueuerProperties.getMQTraceLevel();
}

public void open(String queueName, String queueManagerName) throws MQException, FileNotFoundException
{
if (traceLevel > 0) {
stream = new BufferedOutputStream(new FileOutputStream(fileName, true));
MQEnvironment.enableTracing(traceLevel, stream);
}

manager = new MQQueueManager(queueManagerName);

int options = MQC.MQOO_OUTPUT | MQC.MQOO_INQUIRE | MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_SET_ALL_CONTEXT;

queue = manager.accessQueue(queueName, options);
}

public void send(String data) throws MQException, IOException
{
MQMessage message = new MQMessage();
message.writeString(data);

// Use the same options as set above
MQPutMessageOptions options = new MQPutMessageOptions();

queue.put(message, options);

messagesSent++;
bytesSent += data.length();
}

public void close() throws MQException, IOException
{
queue.close();

manager.disconnect();

if (traceLevel > 0) {
MQEnvironment.disableTracing();
stream.close();
}
}

public int getBytesSent()
{
return bytesSent;
}

public int getMessagesSent()
{
return messagesSent;
}
}


BTW we have no WMQ administrator

Jonathan
Back to top
View user's profile Send private message
bower5932
PostPosted: Fri Nov 26, 2004 5:02 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

I would also have expected an FDC file in one of the errors subdirectories. If you have one, post the top of it.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
naylorjs
PostPosted: Fri Nov 26, 2004 5:11 am    Post subject: FDC file, what FDC file ? Reply with quote

Novice

Joined: 26 Nov 2004
Posts: 10

There are no *.FDC files under /var/mqm on this machine that covers my errors. So I can't help you there I'm afraid.

Jonathan
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Nov 26, 2004 6:04 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

The FDCs would be on the machine hosting the queue manager you are connecting to.

I've never found the MQJE* to be meaningful in a realistic manner. It's always better to get the linked exception.

Is your queue manager up and running? Can you run amqscnxc against it successfully?

Is there anything in the system logs on the queue manager machine?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
naylorjs
PostPosted: Fri Nov 26, 2004 6:51 am    Post subject: Reply with quote

Novice

Joined: 26 Nov 2004
Posts: 10

Here is the result of running amqscnxc on the machine. The client and server are both on the same machine.

$ ./amqscnxc
Sample AMQSCNXC start
Connecting to the default queue manager
with no client connection information specified.
Connection established to queue manager MQ.REG02
Sample AMQSCNXC end
$

There is a log file with todays date on (but still no *FDC files) but it is binary and contains copies of production data which I cannot release. Is there a log analysis tool that I can use ?

As I said we have no WMQ administrators here, and I'm only an application developer so be gentle with me regarding playing around with WMQ. I do know UNIX very well though.

Jonathan
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Nov 26, 2004 6:57 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Is there anything in /var/log/messages?

And again, this is on the machine running MQ, not on the machine running your code.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
naylorjs
PostPosted: Fri Nov 26, 2004 7:17 am    Post subject: Reply with quote

Novice

Joined: 26 Nov 2004
Posts: 10

The /var/adm/message and /var/log/syslog are extremely quiet places, the syslog.conf in /etc appears normal. There is absolutely nothing in these about WMQ in any way, only sendmail and some NTP nonsense.

The client and server are running on the same machine. Running a netstat shows the relevant ports being listened on, as expected.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Nov 26, 2004 7:30 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

I would recheck my code
naylorjs wrote:
// Use the same options as set above
MQPutMessageOptions options = new MQPutMessageOptions();

is not what you think it is. To achieve what your comment says you would need to:
Code:
// Use the same options as set above
MQPutMessageOptions options = new MQPutMessageOptions()|MQC.MQOO_OUTPUT | MQC.MQOO_INQUIRE | MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_SET_ALL_CONTEXT;


Enjoy
Back to top
View user's profile Send private message Send e-mail
naylorjs
PostPosted: Fri Nov 26, 2004 7:50 am    Post subject: Reply with quote

Novice

Joined: 26 Nov 2004
Posts: 10

I think my comment was wrong, although the code appears correct. According to the IBM document:

Code:
// specify the message options...
MQPutMessageOptions pmo = new MQPutMessageOptions(); // accept the defaults,
                                                     // same as
                                                     // MQPMO_DEFAULT
                                                     // constant


This is the value used in the original C version so thats fine by me. I am a little unsure about logical OR-ing the output of a new command in Java unless that was a type and they should have been arguments instead.

Code:
MQPutMessageOptions options = new MQPutMessageOptions(MQC.MQOO_OUTPUT | MQC.MQOO_INQUIRE | MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_SET_ALL_CONTEXT);


I've changed the comments in my code, but not the code itself. Unfortunately it doesn't get that far yet, since it always fails when creating the MQQueueManager object.

Jonathan
Back to top
View user's profile Send private message
naylorjs
PostPosted: Mon Nov 29, 2004 12:37 am    Post subject: Reply with quote

Novice

Joined: 26 Nov 2004
Posts: 10

I think I have a solution to my problem, but it also raises some questions. I commented out setting the MQEnvironment.hostname, port and channel and re-ran the program and voila it appears to work, or at least it doesn't fail.

This then raises the issue about where are the hostname, port and channel set ? Bear in mind that this program replaces an existing C program that does not set any values for hostname, port or channel either, and works correctly.

Can anyone shed any light on this ?

Confused but cautiously happy.

Jonathan
Back to top
View user's profile Send private message
JasonE
PostPosted: Mon Nov 29, 2004 4:37 am    Post subject: Reply with quote

Grand Master

Joined: 03 Nov 2003
Posts: 1220
Location: Hursley

Well if you are not setting the hostname etc, then I would guess you end up with a server connection, whereas if you set them you are doing a client connection. In the equivalent C program, is it running client or server? (link with mqic* or mqm? / MQSERVER or MQCHLLIB,MQCHLTAB set?)

Segment type 156 error sort of implies old java classes being used, although you should not have such a problem because each side of the conenction is supposed to negotiate what is supported. This feels like a defect, although something probably easy to work around (update the hava classes!).
Back to top
View user's profile Send private message
naylorjs
PostPosted: Mon Nov 29, 2004 4:45 am    Post subject: Reply with quote

Novice

Joined: 26 Nov 2004
Posts: 10

Looking at the build script, the C program is linking against libmqm and libmqmzse so following from your description, that implies server.

Where can I download newer Java classes, at least to test with. We are using WMQ 5.3 and all the files, including the JAR and .so files are dated 2002.

I'm hoping that this removal of setting the MQEnvironment is going to be the end of the problems now. Certainly my testing is now at the stage of checking that the data is being received and processed correctly.
Back to top
View user's profile Send private message
JasonE
PostPosted: Mon Nov 29, 2004 4:50 am    Post subject: Reply with quote

Grand Master

Joined: 03 Nov 2003
Posts: 1220
Location: Hursley

When you install MQ you get an option of java (well, you do on windows, I guess its components or something on other platforms), which will install new jar files into <mqm>\java\lib. They would then get updated via service. Mine, for example, are :
Quote:
21/09/2004 01:00 342,326 com.ibm.mq.jar

(Which at a guess are the fixpack 8 level, but given how much I end up hacking around on my machine may not be the case!).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » MQJE038: Unexpected segment type 156 received
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.