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 » User Exits » error in calling rcvexit

Post new topic  This topic is locked: you cannot edit posts or make replies.
 error in calling rcvexit « View previous topic :: View next topic » 
Author Message
samsam007
PostPosted: Wed Dec 10, 2008 2:39 pm    Post subject: error in calling rcvexit Reply with quote

Centurion

Joined: 30 Oct 2008
Posts: 107

Hi,

I think this worth to be a different topic then a *msgext* topic.

With the rcvexit *code* in-placed in the server-connection channel in MQ (v7.0) server, the MQ server received a dll error.

Here is how I created the channel and rcvexit:
Code:

ALTER CHANNEL(TQM3.TCP.CH2) CHLTYPE(SVRCONN) RCVEXIT('msgexit(MsgExit)')
10 : ALTER CHANNEL(TQM3.TCP.CH2) CHLTYPE(SVRCONN) RCVEXIT('msgexit(MsgExit)')


AMQ8016: WebSphere MQ channel changed.

In the remote client windows xp:
D:\MQ Samples>java ExitGetMessage.class NY.TD.INPUT QM.MQT3
Queue name NY.TD.INPUT
Queue manager name QM.MQT3
CALLing mqInit()....
149.1.2.3 --- TQM3.TCP.CH2 --- 1470----sam
MQJE001: An MQException occurred: Completion Code 2, Reason 2009
MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 2009
MQJE001: An MQException occurred: Completion Code 2, Reason 2009
MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 2009
Error in queue manager connect....
QMGR Name : QM.MQT3
CC : 2
RC : 2009
java.lang.NullPointerException
at ExitGetMessage.mqOpen(ExitGetMessage.java:135)
at ExitGetMessage.getConnected(ExitGetMessage.java:70)
at ExitGetMessage.init(ExitGetMessage.java:44)
at ExitGetMessage.main(ExitGetMessage.java:31)

Looking through the Windows event log in the MQ server, the error said:
Code:

User exit not valid.

Channel program 'TQM3.TCP.CH2' ended because user exit 'msgexit(MsgExit)' is not valid.

Ensure that the user exit is specified correctly in the channel definition, and that the user exit program is correct and available.


Here is the exit C code:

Code:

$ cat msgexit.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cmqc.h>
#include <cmqxc.h>

extern void MQENTRY MsgExit(
                        PMQCXP pChannelExitParms,
                        PMQCD pChannelDefinition,
                        PMQLONG pDataLength,
                        PMQLONG pAgentBufferLength,
                        PMQBYTE pAgentBuffer,
                        PMQLONG pExitBufferLength,
                        PMQPTR pExitBufferAddr)

{
        return;
}


This is how I compile the exit code in the MQ server:

Code:

C:\MqExits>cl msgexit.c -o msgexit.c -LD -DEFAULTLIB mqm.lib mqmvx.liB
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

cl : Command line warning D9035 : option 'o' has been deprecated and will be rem
oved in a future release
msgexit.c
Microsoft (R) Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.

/out:msgexit.dll
/out:msgexit.c
/dll
/implib:msgexit.lib
msgexit.obj
mqm.lib
mqmvx.liB

C:\MqExits>copy msgexit.dll "c:\Program Files\IBM\WebSphere MQ\exits"\
Overwrite c:\Program Files\IBM\WebSphere MQ\exits\msgexit.dll? (Yes/No/All): yes

1 file(s) copied.


Thanks
Back to top
View user's profile Send private message
samsam007
PostPosted: Wed Dec 10, 2008 8:51 pm    Post subject: Reply with quote

Centurion

Joined: 30 Oct 2008
Posts: 107

Hi,

I changed the code and name of the program to reflect what it really do.
The rcvexit code is shown as below:

Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cmqc.h>
#include <cmqxc.h>


void MQENTRY RECVEXIT (
                PMQVOID mqcxpptr, /* Channel exit parameter block MQCXP in/out */
                PMQVOID mqcdptr, /* Channel definition MQCD in/out */
                PMQLONG inmsglngptr, /* Length of data in/out */
                PMQLONG inbuflngptr, /* Length of agent buffer in */
                PMQVOID inbufptr, /* Agent buffer MQXQH+data in/out */
                PMQLONG outmsglngptr, /* Length of exit buffer in/out */
                PMQPTR outbufptr ) /* Address of exit buffer in/out */
{

        PMQCXP pMQCXPptr ; // channel exit parameter block pointer.
        PMQCD pMQCDptr ; // channel definition structure pointer.
        PMQMD2 pMQMDptr; // Message descriptor

/*
        MQBYTE outMessage[*inmsglngptr+104]; // First 104 bytes are MQXQH contents
        MQLONG outMessageLength=*inmsglngptr;
        PMQMD2 outMQMDptr;
        MQCHAR BUFFER[32];

        *outmsglngptr=outMessageLength;


// Check the contents
//...........


        if(MyMQCD_ChannelType == MQCHT_SVRCONN)
        {
                if(MyMQCXP_ExitId == MQXT_CHANNEL_RCV_EXIT)
                {
                        memcpy (MyMQMD_ConnectionName, pMQCDptr->ConnectionName, sizeof(pMQCDptr->ConnectionName) ) ;
                        strtok(MyMQMD_ConnectionName, " ");
                        strcat(BUFFER, MyMQMD_ConnectionName);
                        memcpy(outMQMDptr->ApplIdentityData, BUFFER, sizeof(BUFFER)) ;
                }
                //mTrace ( Trace_log_stream, "Outside MQXT_CHANNEL_RCV_EXIT" ) ;
        }
        //mTrace ( Trace_log_stream, "Outside MQCHT_SVRCONN" ) ;
        *outbufptr=outMessage;
        *outmsglngptr=outMessageLength;
*/
        pMQCXPptr->ExitResponse2 = MQXR2_USE_EXIT_BUFFER; // indicate OK end.
        pMQCXPptr->ExitResponse = MQXCC_OK ;

}


In the windows event viewer, the error shown:
Code:

User exit not valid. 

Channel program 'TQM3.TCP.CH2' ended because user exit 'mms_rcvexit(RECVEXIT)' is not valid. 

Ensure that the user exit is specified correctly in the channel definition, and that the user exit program is correct and available.


Here is my .bat file:
Code:

$ cat mms_rcvexit.bat
cl -MT -c mms_rcvexit.c /DWIN32 /DWIN32_SHM /DHNLUP
link /DLL -out:mms_rcvexit.dll mms_rcvexit.obj mqm.lib
copy mms_rcvexit.dll "C:\program files\ibm\websphere mq\exits"


I am not sure how to correct the error and where it goes wrong.
I 'm really just using "trial-and-error" method to try to get the result.
I am very appreciate for your help.

Thanks


~
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Dec 11, 2008 12:33 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

samsam007 wrote:
I 'm really just using "trial-and-error" method to try to get the result.


This really is not such a good idea. Exits are an advanced topic in WMQ; even if you get it "working", you could find odd effects within the queue manager.

Taking a step back from the exit, what exactly are you attempting to achieve here? What requirement will this exit fulfil that can't be done with other methods? There may be easier alternatives.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
samsam007
PostPosted: Thu Dec 11, 2008 2:46 pm    Post subject: Reply with quote

Centurion

Joined: 30 Oct 2008
Posts: 107

Vitor wrote:
samsam007 wrote:
I 'm really just using "trial-and-error" method to try to get the result.


This really is not such a good idea. Exits are an advanced topic in WMQ; even if you get it "working", you could find odd effects within the queue manager.

Taking a step back from the exit, what exactly are you attempting to achieve here? What requirement will this exit fulfil that can't be done with other methods? There may be easier alternatives.


The current project have *2 levels* of authentication, the first one is the user-id (Not the password) done by BlockIP2 in the channel security exit; the 2nd one is with message or receive exit. Since there is only a server-connection channel, we want to implement the 2nd level of authenticaiton at the receive exit. The receive exit basically authenticate a *security code* that entered or implemented by the client application. All authentication is done in quiet mode (not the user-interaction mode).

Thanks
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Dec 11, 2008 3:30 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Why not use SSL?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
samsam007
PostPosted: Thu Dec 11, 2008 3:32 pm    Post subject: Reply with quote

Centurion

Joined: 30 Oct 2008
Posts: 107

Vitor wrote:
Why not use SSL?


It is internal system, no need SSL.
We will implement SSL with external system.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Dec 11, 2008 3:37 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

samsam007 wrote:
It is internal system, no need SSL.


SSL is too much trouble for an internal system, so you beat yourself up with this exit?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
samsam007
PostPosted: Thu Dec 11, 2008 4:48 pm    Post subject: Reply with quote

Centurion

Joined: 30 Oct 2008
Posts: 107

Vitor wrote:
samsam007 wrote:
It is internal system, no need SSL.


SSL is too much trouble for an internal system, so you beat yourself up with this exit?


Yes, you may be right.
But this is the organisation preference. I have told them ssl is more standard way to handle the user-id auth.
But I need to demonstrate how to use receive exit and therefore propose a valid solution to them. If they come and ask me, how does receive exit downgrade used to check that *secret code* embedded in the message header, I need to show them how and why this is not worth.

I found a redbook from IBM has an example mqchexit.c, but it require VisualAge C++ V3.5 to compile. Why all these examples are using different compiler for windows platform? Visual C/C++ is more popular in these days.

Does anyone have a *simple* instruction about how to compile this exit code and work under windows 2005/7?

This is the .bat file I used to compile the exit code:
Code:

C:\MqExits>type mms_rcvexit.bat
cl -MT -c mms_rcvexit.c /DWIN32 /DWIN32_SHM /DHNLUP
link /DLL -out:mms_rcvexit.dll mms_rcvexit.obj mqm.lib
copy mms_rcvexit.dll "C:\program files\ibm\websphere mq\exits"


I really just need a simple example to get this demo working, then I can do the rest.

Thanks
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Wed Dec 17, 2008 4:06 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3253
Location: London, ON Canada

samsam007 wrote:
I really just need a simple example to get this demo working, then I can do the rest.



If you can't get my simple exit to work and that is the easy part then you will never get the "rest" done.
http://www.mqseries.net/phpBB2/viewtopic.php?t=20523


Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
Vitor
PostPosted: Thu Dec 18, 2008 1:57 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

RogerLacroix wrote:
If you can't get my simple exit to work and that is the easy part then you will never get the "rest" done.
http://www.mqseries.net/phpBB2/viewtopic.php?t=20523




I certainly don't see how beating yourself up with this exit remains a profitable use of your time, or your company's money.

Taking a step back, consider the maintenance effort of this solution. If it's taken this long to produce your exit, what's going to happen when the requirement changes? Someone, possibly yourself or maybe some poor newbie, will be tasked with making the changes and will have to go round this loop again. Hence Total Cost of Ownership of this will be significantly higher than a solution your management is currently less excited about.

I also remain unconvinced that this exit is the solution to your requirements. It's more likely to be the solution to the requirement your management think they have.

But that's just me.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
samsam007
PostPosted: Thu Dec 18, 2008 3:01 pm    Post subject: Reply with quote

Centurion

Joined: 30 Oct 2008
Posts: 107

RogerLacroix wrote:
samsam007 wrote:
I really just need a simple example to get this demo working, then I can do the rest.



If you can't get my simple exit to work and that is the easy part then you will never get the "rest" done.
http://www.mqseries.net/phpBB2/viewtopic.php?t=20523


Regards,
Roger Lacroix
Capitalware Inc.


I have the sample code working just in 1 minute after I have seen the post.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Dec 19, 2008 1:02 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

samsam007 wrote:

I have the sample code working just in 1 minute after I have seen the post.


Then you won't need any further help....
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  This topic is locked: you cannot edit posts or make replies. Page 1 of 1

MQSeries.net Forum Index » User Exits » error in calling rcvexit
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.