Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
MQMessage queueMessage = new MQMessage();

/* Set up a loop exit flag */

boolean done = false;
do {
try {

/* Reset the message and IDs to be empty */

queueMessage.correlationId = MQC.MQCI_NONE;
queueMessage.messageId = MQC.MQMI_NONE;
/* Browse the message, display it, and ask if the */
Posts: 26
MyEclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
And then we all jump out and yell "surprise! we got you this tiny ad!"
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic