2035 is certainly authentication problem. The user id trying to connect doesn't have access to the MQ resource.
Regarding, your below comment:
If I use WebSphere's JAAS authentication to provide the userid, then I always get the JMSWMQ2013 error. , however, if explicitly pass the same userid to the JMS queue connection factory's call to createQueueConnection(), then I don't get the authentication error.
Your expectation is correct. Both techniques should behave in the same way. If user id has access then both should connect, if not then both should throw error.
Only explanation to your problem may be, that you are unknowingly sending different user ids in these apps.
Like, your user id is "User123", and it has access to the MQ resource.
However, may be WebSphere's JAAS authentication is sending Domain along with user id. Say, your user id is in "Developer" domain, then the user id being sent is "Developer\User123", which may not be having access to the resource.