|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Java Security Exit for MQ V6 |
« View previous topic :: View next topic » |
Author |
Message
|
Yannanlu |
Posted: Wed Aug 30, 2006 12:47 pm Post subject: Java Security Exit for MQ V6 |
|
|
Apprentice
Joined: 23 Jan 2002 Posts: 27
|
I am trying to test the client side security exit on MQ V6 as suggested in http://www-128.ibm.com/developerworks/websphere/library/techarticles/0512_ritchie/0512_ritchie.html. The source code is as follows:
Code: |
package example;
public class SecurityExit implements com.ibm.mq.MQSecurityExit {
public byte[] securityExit(MQChannelExit channelExitParms,
MQChannelDefinition channelDefParms,
byte[] agentBuffer) {
switch (channelExitParms.exitReason) {
case MQC.MQXR_INIT:
// initialize etc.
break;
case MQC.MQXR_INIT_SEC:
// transmit MCAUserId if desired etc.
break;
case MQC.MQXR_SEC_PARMS:
// create a new MQCSP object
MQConnectionSecurityParameters csp = new MQConnectionSecurityParameters();
// set authenticationType to AUTH_USER_ID_AND_PWD
csp.setAuthenticationType(MQC.MQCSP_AUTH_USER_ID_AND_PWD);
// set CSP UserId and password from the JMS-supplied values
csp.setCSPUserId(channelDefParms.remoteUserId.trim());
csp.setCSPPassword(channelDefParms.remotePassword.trim());
// finally add MQCSP object to the channelExitParms
channelExitParms.setMQCSP(csp);
break;
case MQC.MQXR_TERM:
// etc.
}
return agentBuffer;
}
} |
But when I try to run the Java client, I got the following exception:
Code: |
Linked exception: java.lang.NoSuchMethodException: SecurityExit.<init>(java.lang.String)
javax.jms.JMSException: MQJMS1009: no constructor with string argument
at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:567)
at com.ibm.mq.jms.MQConnection.newExitInstance(MQConnection.java:1669)
at com.ibm.mq.jms.MQConnection.supportThreeExits(MQConnection.java:2212)
at com.ibm.mq.jms.MQConnection.<init>(MQConnection.java:498)
at com.ibm.mq.jms.MQQueueConnection.<init>(MQQueueConnection.java:73)
at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:185)
at QConnector.connect(QConnector.java:351)
at QConnector.<init>(QConnector.java:301)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at QCopy.main(QCopy.java:259) |
Anyone see this problem before? I have no idea which method is missing.
Thanks a lot,
Yannan |
|
Back to top |
|
 |
wschutz |
Posted: Wed Aug 30, 2006 2:29 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Can we see the code thats thorwing this? _________________ -wayne |
|
Back to top |
|
 |
Yannanlu |
Posted: Wed Aug 30, 2006 4:03 pm Post subject: |
|
|
Apprentice
Joined: 23 Jan 2002 Posts: 27
|
Thanks for the quick response. The code is something like this:
MQQueueConnectionFactory mqcf = new MQQueueConnectionFactory();
mqcf.setHostName("localhost");
mqcf.setChannel("SYSTEM.DEF.SVRCONN");
mqcf.setSecurityExit("SecurityExit");
QueueConnectionFactory cf = (QueueConnectionFactory) mqcf;
QueueConnection qc = cf.createQueueConnection("testuser", "secret");
...
After some trial and error, I have added a contructor:
public SecurityExit(String key) {
}
It fixed the exception and everything is OK. Looks like the contructor requires the String as the only argument.
This one only works for MQ V6. I am not able to compile it on MQ V5.3, though.
Thanks,
Yannan |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|