Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
[MB-1800] [Tenant / Durable Subscription] When creating a durable subscription for a tenant domain, permission denied error is displayed Created: 26/Sep/16 Updated: 27/Sep/16 Resolved: 27/Sep/16 Status: Project: Component/s: Affects Version/s: Fix Version/s: Resolved WSO2 Message Broker None WSO2 MB 3.2.0 - M3 Type: Reporter: Resolution: Labels: Remaining Estimate: Time Spent: Original Estimate: Environment: Bug Pubudu D.P Fixed None Not Specified Attachments: QueueSubscriber.jmx Major Moderate WSO2 MB 3.2.0 - Beta Priority: Assignee: Votes: Highest Indika Sampath 0 Not Specified Not Specified Pack: MB 3.2.0 M3 (post) Setup: Standalone JDK: Oracle 1.8.0_51 DB: H2 (default db) jndiqueues.properties Severity: Estimated Complexity: Test cases added: Yes Description Pre-conditions: A tenant domain 'qa.com' should be created Tenant admin should have the following credentials username: [email protected] password: adminqa Jmeter Topic subscriber should exist (attached) Steps:1. Start the Subscriber Jmeter script to create a durable subscription in qa.com tenant domain 2. Check the Jmeter log 3. Check the server log Expected Results: A durable subscription should be successfully created in qa.com tenant domain. Actual Results: Permission denied error is displayed in Jmeter logs [1] Subscription is not being created successfully. logs [3] Note: Same error was observed in Java client [2] for the same tenant domain [1] 2016/09/26 15:06:24 INFO - jmeter.engine.StandardJMeterEngine: Running the test! 2016/09/26 15:06:24 INFO - jmeter.samplers.SampleEvent: List of sample_variables: [] 2016/09/26 15:06:24 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(true,*local*) 2016/09/26 15:06:24 INFO - jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1 : 2016/09/26 15:06:24 INFO - jmeter.engine.StandardJMeterEngine: Starting 1 threads for gro 2016/09/26 15:06:24 INFO - jmeter.engine.StandardJMeterEngine: Thread will continue on er 2016/09/26 15:06:24 INFO - jmeter.threads.ThreadGroup: Starting thread group number 1 thr 1000.0 delayedStart=false 2016/09/26 15:06:24 INFO - jmeter.threads.ThreadGroup: Started thread group number 1 2016/09/26 15:06:24 INFO - jmeter.engine.StandardJMeterEngine: All thread groups have bee 2016/09/26 15:06:24 INFO - jmeter.threads.JMeterThread: Thread started: Queue Subscriber 2016/09/26 15:06:24 ERROR - jmeter.protocol.jms.client.ReceiveSubscriber: Error during clo javax.jms.JMSException: Error closing connection: org.wso2.andes.AMQConnectionClosedExcept denied: queue-name 'carbon:d3x' [error code 541: internal error] at org.wso2.andes.client.AMQConnection.doClose(AMQConnection.java:971) at org.wso2.andes.client.AMQConnection.close(AMQConnection.java:897) at org.wso2.andes.client.AMQConnection.close(AMQConnection.java:888) at org.wso2.andes.client.AMQConnection.close(AMQConnection.java:883) at org.apache.jmeter.protocol.jms.Utils.close(Utils.java:78) at org.apache.jmeter.protocol.jms.client.ReceiveSubscriber.close(ReceiveSubscriber at org.apache.jmeter.protocol.jms.client.ReceiveSubscriber.<init>(ReceiveSubscribe at org.apache.jmeter.protocol.jms.client.ReceiveSubscriber.<init>(ReceiveSubscribe at org.apache.jmeter.protocol.jms.sampler.SubscriberSampler.initReceiveClient(Subs at org.apache.jmeter.protocol.jms.sampler.SubscriberSampler.threadStarted(Subscrib at org.apache.jmeter.threads.JMeterThread$ThreadListenerTraverser.addNode(JMeterTh at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:998) at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:980) at org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:579) at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:567) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257) at java.lang.Thread.run(Thread.java:745) Caused by: org.wso2.andes.AMQConnectionClosedException: Error: Permission denied: queue-na 541: internal error] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessor at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructor at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.wso2.andes.AMQException.cloneForCurrentThread(AMQException.java:110) at org.wso2.andes.client.protocol.AMQProtocolHandler.writeCommandFrameAndWaitForReply(AMQProt at org.wso2.andes.client.protocol.AMQProtocolHandler.syncWrite(AMQProtocolHandler. at org.wso2.andes.client.protocol.AMQProtocolHandler.closeConnection(AMQProtocolHa at org.wso2.andes.client.AMQConnectionDelegate_8_0.closeConnection(AMQConnectionDe at org.wso2.andes.client.AMQConnection.doClose(AMQConnection.java:955) ... 16 more Caused by: org.wso2.andes.AMQConnectionClosedException: Error: Permission denied: queue-na 541: internal error] at org.wso2.andes.client.handler.ConnectionCloseMethodHandler.methodReceived(ConnectionCloseM at org.wso2.andes.client.handler.ClientMethodDispatcherImpl.dispatchConnectionClose(ClientMet at org.wso2.andes.framing.amqp_0_91.ConnectionCloseBodyImpl.execute(ConnectionClos at org.wso2.andes.client.state.AMQStateManager.methodReceived(AMQStateManager.java at org.wso2.andes.client.protocol.AMQProtocolHandler.methodBodyReceived(AMQProtoco at org.wso2.andes.client.protocol.AMQProtocolSession.methodFrameReceived(AMQProtoc at org.wso2.andes.framing.AMQMethodBodyImpl.handle(AMQMethodBodyImpl.java:96) at org.wso2.andes.client.protocol.AMQProtocolHandler$2.run(AMQProtocolHandler.java at org.wso2.andes.pool.Job.processAll(Job.java:111) at org.wso2.andes.pool.Job.run(Job.java:158) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ... 1 more 2016/09/26 15:06:24 ERROR - jmeter.protocol.jms.sampler.SubscriberSampler: Could not initi javax.jms.JMSException: Error registering consumer: org.wso2.andes.AMQConnectionClosedExce denied: queue-name 'carbon:d3x' [error code 541: internal error] at org.wso2.andes.client.AMQSession$6.execute(AMQSession.java:2143) at org.wso2.andes.client.AMQSession$6.execute(AMQSession.java:2086) at org.wso2.andes.client.AMQConnectionDelegate_8_0.executeRetrySupport(AMQConnecti at org.wso2.andes.client.AMQConnection$3.run(AMQConnection.java:655) at java.security.AccessController.doPrivileged(Native Method) at org.wso2.andes.client.AMQConnection.executeRetrySupport(AMQConnection.java:652) at org.wso2.andes.client.failover.FailoverRetrySupport.execute(FailoverRetrySuppor at org.wso2.andes.client.AMQSession.createConsumerImpl(AMQSession.java:2084) at org.wso2.andes.client.AMQSession.createConsumer(AMQSession.java:1072) at org.wso2.andes.client.AMQSession.createDurableSubscriber(AMQSession.java:1226) at org.wso2.andes.client.AMQSession.createDurableSubscriber(AMQSession.java:1121) at org.apache.jmeter.protocol.jms.client.ReceiveSubscriber.createSubscriber(Receiv at org.apache.jmeter.protocol.jms.client.ReceiveSubscriber.<init>(ReceiveSubscribe at org.apache.jmeter.protocol.jms.client.ReceiveSubscriber.<init>(ReceiveSubscribe at org.apache.jmeter.protocol.jms.sampler.SubscriberSampler.initReceiveClient(Subs at org.apache.jmeter.protocol.jms.sampler.SubscriberSampler.threadStarted(Subscrib at org.apache.jmeter.threads.JMeterThread$ThreadListenerTraverser.addNode(JMeterTh at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:998) at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:980) at org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:579) at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:567) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257) at java.lang.Thread.run(Thread.java:745) Caused by: org.wso2.andes.AMQConnectionClosedException: Error: Permission denied: queue-na 541: internal error] at org.wso2.andes.client.handler.ConnectionCloseMethodHandler.methodReceived(ConnectionCloseM at org.wso2.andes.client.handler.ClientMethodDispatcherImpl.dispatchConnectionClose(ClientMet at org.wso2.andes.framing.amqp_0_91.ConnectionCloseBodyImpl.execute(ConnectionClos at org.wso2.andes.client.state.AMQStateManager.methodReceived(AMQStateManager.java at org.wso2.andes.client.protocol.AMQProtocolHandler.methodBodyReceived(AMQProtoco at org.wso2.andes.client.protocol.AMQProtocolSession.methodFrameReceived(AMQProtoc at org.wso2.andes.framing.AMQMethodBodyImpl.handle(AMQMethodBodyImpl.java:96) at org.wso2.andes.client.protocol.AMQProtocolHandler$2.run(AMQProtocolHandler.java at org.wso2.andes.pool.Job.processAll(Job.java:111) at org.wso2.andes.pool.Job.run(Job.java:158) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ... 1 more 2016/09/26 15:06:24 INFO - jmeter.threads.JMeterThread: Thread is done: Queue Subscriber 2016/09/26 15:06:24 INFO - jmeter.threads.JMeterThread: Thread finished: Queue Subscriber 2016/09/26 15:06:24 INFO - jmeter.engine.StandardJMeterEngine: Notifying test listeners o 2016/09/26 15:06:24 INFO - jmeter.protocol.jms.client.InitialContextFactory: InitialConte and Context instances cleaned up 2016/09/26 15:06:24 INFO - jmeter.gui.util.JMeterMenuBar: setRunning(false,*local*) [2] Java Client package org.wso2.mbtest.topics.durable.subscriber; /** * Created by pubudup on 9/26/16. */ import import import import import import import import import import javax.jms.Message; javax.jms.QueueSession; javax.jms.TextMessage; javax.jms.Topic; javax.jms.TopicConnection; javax.jms.TopicConnectionFactory; javax.jms.TopicSession; javax.naming.Context; javax.naming.InitialContext; java.util.Properties; public class DurableTopicSubscriber1 { public static final String ANDES_ICF = "org.wso2.andes.jndi.PropertiesFileInitialConte private static final String CF_NAME_PREFIX = "connectionfactory."; private static final String CF_NAME = "andesConnectionfactory"; // String userName = "message"; // String password = "message"; String userName = "adminqa!qa.com"; String password = "adminqa"; private SampleMessageListener messageListener; private static String CARBON_CLIENT_ID = "carbon"; private static String CARBON_VIRTUAL_HOST_NAME = "carbon"; private static String CARBON_DEFAULT_PORT = "5672"; private boolean useListener = true; private int delayBetMessages = 0; private static String CARBON_DEFAULT_HOSTNAME = "10.100.7.59"; // private String topicName = "srilanka.jan.*"; // private String topicName = "testselectorDLCtest1"; private String topicName = "qa.com/sharedsub999"; // private String topicName = "sharedsub2"; private String subscriptionId = "qa.com/sahred999"; private int messageCount = 5000; public static void main(String[] args) { //System.setProperty("AndesAckWaitTimeOut", "10000"); DurableTopicSubscriber durableTopicSubscriber = new DurableTopicSubscriber(); durableTopicSubscriber.subscribe(); } public void subscribe() { try { Properties properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, ANDES_ICF); properties.put(CF_NAME_PREFIX + CF_NAME, getTCPConnectionURL(userName, passwor properties.put("topic."+topicName,topicName); System.out.println("getTCPConnectionURL(userName,password) = " + getTCPConnect password)+":::Topic_Name:::"+topicName+"::Listen To:::"+CARBON_DEFAULT_HOSTNAME+"::Subcrip InitialContext ctx = new InitialContext(properties); // Lookup connection factory TopicConnectionFactory connFactory = (TopicConnectionFactory) ctx.lookup(CF_NA TopicConnection topicConnection = connFactory.createTopicConnection(); topicConnection.start(); TopicSession topicSession = topicConnection.createTopicSession(false, QueueSession.AUTO_ACKNOWLEDG Topic topic = (Topic) ctx.lookup(topicName); // Create a durable subscriber with subscription ID and message selector ::::: topic, String messageSelector, boolean noLocal) // javax.jms.TopicSubscriber topicSubscriber = topicSession.createDurableSubscriber(topic,subscriptionId,"JMSType = 'TWO'",true); javax.jms.TopicSubscriber topicSubscriber = topicSession.createDurableSubscrib if(useListener) { messageListener = new SampleMessageListener(topicConnection,topicSession,t delayBetMessages,messageCount,subscriptionId,CARBON_DEFAULT_HOSTNA topicSubscriber.setMessageListener(messageListener); } else { for(int count=1;count<messageCount;count++) { Message message = topicSubscriber.receive(); if (message instanceof TextMessage) { TextMessage textMessage = (TextMessage) message; String msgID=textMessage.getStringProperty("msgID"); System.out.println(count+ ":::::Message Content:::::: " + textMessage.getText()+":::Subscription Id :::"+subscriptionId+":::::Listen To:::"+topicNam IP:::"+CARBON_DEFAULT_HOSTNAME+":::::With msgID:::"+msgID); } if(delayBetMessages !=0) { Thread.sleep(delayBetMessages); } } topicConnection.close(); } } catch (Exception e) { e.printStackTrace(); } } public String getTCPConnectionURL(String username, String password) { return new StringBuffer() .append("amqp://").append(username).append(":").append(password) .append("@").append(CARBON_CLIENT_ID) .append("/").append(CARBON_VIRTUAL_HOST_NAME) .append("?brokerlist='tcp://").append(CARBON_DEFAULT_HOSTNAME).append(":").append(CARBON_D .toString(); } public void stop(){ this.messageListener.closingSubscription(); } } [3] MB logs [2016-09-26 15:56:02,789] @qa.com [1] [MB] INFO {org.wso2.andes.kernel.AndesChannel} - Ch 127.0.0.1:43422) [2016-09-26 15:56:02,819] INFO {org.wso2.andes.server.protocol.AMQProtocolEngine} - Clos Permission denied: queue-name 'carbon:xxx' [2016-09-26 15:56:02,821] INFO {org.wso2.andes.server.protocol.AMQProtocolEngine} - Perm 'carbon:xxx' whilst processing:[QueueDeclareBodyImpl: ticket=0, queue=carbon:xxx, passive= exclusive=true, autoDelete=false, nowait=false, arguments=null] [2016-09-26 15:56:02,821] INFO {org.wso2.andes.server.protocol.AMQProtocolEngine} - Clos org.wso2.andes.AMQConnectionException: Permission denied: queue-name 'carbon:xxx' [error c [2016-09-26 15:56:02,832] INFO {org.wso2.andes.kernel.FlowControlManager} - Channel remo [2016-09-26 15:56:02,834] INFO {org.wso2.andes.server.handler.ConnectionCloseOkMethodHand Connection-close-ok Comments Comment by Pubudu D.P [ 26/Sep/16 ] Note:This issue is only observed for durable subscriptions. Normal subscriptions are working as expected. Comment by Indika Sampath [ 27/Sep/16 ] Please find the PR - https://github.com/wso2/carbon-business-messaging/pull/355 Generated at Thu May 04 10:37:49 IST 2017 using JIRA 7.2.2#72004sha1:9d5132893cc8c728a3601a9034a1f8547ef5c7be.