• 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 ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

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

 
Greenhorn
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();
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 */
 
Greenhorn
Posts: 26
MyEclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!