Author |
Message
|
muyu77 |
Posted: Wed Oct 20, 2004 12:55 am Post subject: MQ communicate program |
|
|
Newbie
Joined: 20 Oct 2004 Posts: 5
|
I communicate between two AIX Servers by MQ,aix1,aix2
aix1 is sender
the data is an array xxsPart[][]
ObjectMessage objmsg = sessionSend.createObjectMessage();
objmsg.setObject(xxsPart);
objmsg.setStringProperty("identifier", identifier);
sender.send(objmsg);
aix2 is receiver
Message aMessage = receiver.receive(Long.parseLong(resMQ.getString("TIMEOUT")));
if (aMessage != null) {
ObjectMessage objmsg = (ObjectMessage) aMessage;
xxsPart = (String[][]) objmsg.getObject();
}
but when I execute the command
ObjectMessage objmsg = (ObjectMessage) aMessage;
return an error:
java.lang.ClassCastException: com.ibm.jms.JMSBytesMessage
who can slove the problem for me
thanks |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Oct 20, 2004 6:18 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
What version (use mqver) are you using on your two aix boxes? I believe there were several classcastexceptions that were fixed with (or after) FixPack 4. |
|
Back to top |
|
 |
muyu77 |
Posted: Wed Oct 20, 2004 10:44 pm Post subject: |
|
|
Newbie
Joined: 20 Oct 2004 Posts: 5
|
thank your answer,but I can not understand you mean "fixpack 4", can you tell me how to slove it. My MQ version is 5.3
very thank you |
|
Back to top |
|
 |
siliconfish |
Posted: Wed Oct 20, 2004 10:52 pm Post subject: |
|
|
 Master
Joined: 12 Aug 2002 Posts: 203 Location: USA
|
|
Back to top |
|
 |
muyu77 |
Posted: Wed Oct 20, 2004 11:42 pm Post subject: |
|
|
Newbie
Joined: 20 Oct 2004 Posts: 5
|
several weeks,I can runing the program and receive the message,but now has the error, I think the error is not Fix Pack 4 problem.
at aix1
installed was4
so the JMSAdmin.config is
INITIAL_CONTEXT_FACTORY=com.ibm.websphere.naming.WsnInitialContextFactory
PROVIDER_URL=iiop://localhost:2222/
SECURITY_AUTHENTICATION=none
at aix2
not installed was
so the JMSAdmin.config is
INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
PROVIDER_URL=file:/usr/mqm/java/bin
SECURITY_AUTHENTICATION=none
is right for setting the JMSAdmin.config file ? |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Oct 21, 2004 5:36 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
You jmsadmin files look ok to me. I'd still like to see the output of the mqver command from both boxes. Also, if this error is just now showing up, has anything changed? |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Oct 21, 2004 1:58 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
My guess is you are receiving the object message from a non JMS sender I.e. the message is missing the RFH2 header.
The solution: Treat it as a BytesMessage, extract the bytes into a buffered reader and read the object from the reader.
Have fun  |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Oct 22, 2004 5:47 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
fjb_saper wrote: |
My guess is you are receiving the object message from a non JMS sender I.e. the message is missing the RFH2 header. |
And you could test this by running amqsbcg against the queue to see if the message has the header or not. |
|
Back to top |
|
 |
muyu77 |
Posted: Sun Oct 24, 2004 9:56 pm Post subject: |
|
|
Newbie
Joined: 20 Oct 2004 Posts: 5
|
I have check it , the message is missing the RFH2 header.
but why . how to slove it |
|
Back to top |
|
 |
|