File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Websphere and the fly likes I developed a Java program to delete Message Queues using WAS7 ,but getting MQ EXCEPTION: 2035 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "I developed a Java program to delete Message Queues using WAS7 ,but getting MQ EXCEPTION: 2035 " Watch "I developed a Java program to delete Message Queues using WAS7 ,but getting MQ EXCEPTION: 2035 " New topic
Author

I developed a Java program to delete Message Queues using WAS7 ,but getting MQ EXCEPTION: 2035

lakshminarayana Maruth
Greenhorn

Joined: Jul 06, 2012
Posts: 1
I am running this code using cron ,I have all the permissions under WSADMIN ,but i am getting MQEXCEPTION for reasoncode 2035 ,I know this is UnAuthorised Queue manger connection,
When i was tested this code ,the same exception was returned so i used this command to run the code ie sudo su - wsadmin,then it works fine
Note : I want to run this on root ,when i run this using cron script on root ,i am getting MQ Exception 2035,do we need to provide the permission to root also or is there any other simpler way to accomlish this,please see this code BOLD is where the program controll is terminating about the permissions

public int browseDeleteQueue( String queueManager,String queueName,String jobInterval,
long currentTime ) throws SystemException
{
int status =0;
int count=0;
MQQueue queue =null;
MQQueueManager qMgr=null;
try {
LogManager.logInfo("Method entry -MessageUtil::browseDeleteQueue("+queueManager+" , "+queueName+" , "+jobInterval+" , "+currentTime);
LogManager.logInfo( "MQMessage: browseQueue. Queue Name: "
+ queueName );
int openOptions = MQC.MQOO_INPUT_EXCLUSIVE | MQC.MQOO_BROWSE; // String queueManager=PropertiesReader.getEntitlementReader().getValue(BEEConstants.QUEUEMANAGER );


qMgr = new MQQueueManager(queueManager);

queue = qMgr.accessQueue(queueName, openOptions,
null, null, null);
//int depth = queue.getCurrentDepth();
//System.out.println("depth of Queue ="+depth);

MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_FIRST;
MQMessage queueMessage = new MQMessage();

/***************************/
/* Set up a loop exit flag */
/***************************/

boolean done = false;
do {
try {

/*****************************************/
/* Reset the message and IDs to be empty */
/*****************************************/
queueMessage.clearMessage();

queueMessage.correlationId = MQC.MQCI_NONE;
queueMessage.messageId = MQC.MQMI_NONE;
LogManager.logInfo("correlationId"+queueMessage.correlationId);
/**************************************************/
/* Browse the message, display it, and ask if the */
uday kantt
Greenhorn

Joined: May 05, 2011
Posts: 26

hi
the error could be the username and password to access the Queue manager are incorrect or else looking at the code in bold : Does that return a string, so typecast it to int.
thats what i could guess.
 
 
subject: I developed a Java program to delete Message Queues using WAS7 ,but getting MQ EXCEPTION: 2035