Announcement Announcement Module
Collapse
No announcement yet.
Dbus JMS - Message Listener - javax.jms.JMSSecurityException: Not permitted Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dbus JMS - Message Listener - javax.jms.JMSSecurityException: Not permitted

    Hi Team,
    I was able to successfully post onto Dbus JMS Queue.
    However, when i try to consume the messages from the queue using int-jms:message-driven-channel-adapter i'm getting the following exception -

    javax.jms.JMSSecurityException: Not permitted

    Have attached the stack trace for the same.

    Below mentioned is the jms config for the listener -
    Code:
    <!-- Message Consumer Configuration For Ack/Nack from Queue2 --> 
    
            <util:properties id="dbusEnvironment"> 
                    <prop key="java.naming.provider.url">${java.naming.provider.url}</prop> 
                    <prop key="java.naming.factory.initial">${java.naming.factory.initial}</prop> 
                    <prop key="java.naming.security.credentials">${java.naming.security.credentials}</prop> 
                    <prop key="java.naming.security.principal">${java.naming.security.principal}</prop> 
            </util:properties> 
            
            <bean id="inboundAuthenticationConnectionFactory" 
                    class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter"> 
                    <property name="targetConnectionFactory" ref="dbusListenerJmsConnectionFactory" /> 
                    <property name="username" value="${java.username}" /> 
                    <property name="password" value="${java.password}" /> 
            </bean> 
    
            <jee:jndi-lookup id="dbusListenerJmsConnectionFactory" 
                    jndi-name="${int.dbus.jms.connectionfactory}" environment-ref="dbusEnvironment" /> 
    
            <bean id="jmsTransactionManager" 
                    class="org.springframework.jms.connection.JmsTransactionManager"> 
                    <property name="connectionFactory" ref="inboundAuthenticationConnectionFactory" /> 
            </bean> 
    
            <bean id="dbusQueueContainer" 
                    class="org.springframework.jms.listener.DefaultMessageListenerContainer"> 
                    <property name="connectionFactory" ref="inboundAuthenticationConnectionFactory" /> 
                    <property name="destinationName" value="${int.dbus.jms.inbound.queue}" /> 
                    <property name="transactionManager" ref="jmsTransactionManager" /> 
                    <property name="durableSubscriptionName" value="${int.dbus.durable.sub.id}" /> 
                    <property name="pubSubDomain" value="true" /> 
                    <property name="subscriptionDurable" value="true" /> 
                    <property name="sessionTransacted" value="true" /> 
                    <property name="clientId" value="${int.dbus.client.id}" /> 
                    <property name="autoStartup" value="false" /> 
                    <property name="receiveTimeout" value="${dbus.receive.timeout}" /> 
    
                    <property name="cacheLevel"> 
                            <util:constant 
                                    static-field="org.springframework.jms.listener.DefaultMessageListenerContainer.CACHE_CONSUMER" /> 
                    </property> 
            </bean> 
    
            <int-jms:message-driven-channel-adapter 
                    acknowledge="client" extract-payload="true" channel="com.hcl.jms.inbound" 
                    error-channel="errorChannel" container="dbusQueueContainer" />

    I'm suspecting something to do with the way i'm passing the queue credentials. LDAP seems to be fine, no exceptions.

    Garry, appreciate your inputs on the issue

    Regards,
    PD

  • #2
    It looks like it doesn't support, or you don't have permission for, durable subscriptions...

    Line 493 in the APMLC is

    return session.createDurableSubscriber(
    (Topic) destination, getDurableSubscriptionName(), getMessageSelector(), isPubSubNoLocal());

    Comment


    • #3
      javax.jms.InvalidDestinationException: Not allowed to create destination

      Hi Gary, you were right, i had given durable subscription config for the Queue, where as it should only be for Topics.

      I rectified the issue and now facing the below exception - javax.jms.InvalidDestinationException: Not allowed to create destination

      Correct me if i'm wrong - This exception is thrown when the DestinationName does not exist, but i'm able to send messages to the queue - /db/us/GM/LS2API/S001DEV/db.messaging.inbound.q:queue , facing this exception while trying to retrieve.

      Or is it that i should use the destination property instead of the destinationName in the container ?

      [19.07.2013 23:26:57] WARN: DefaultMessageListenerContainer.handleListenerSetu pFailure() - Setup of JMS message listener invoker failed for destination '/db/us/GM/LS2API/S001DEV/db.messaging.inbound.q:queue' - trying to recover. Cause: Not allowed to create destination
      javax.jms.InvalidDestinationException: Not allowed to create destination
      at com.tibco.tibjms.Tibjmsx.buildException(Tibjmsx.ja va:360)
      at com.tibco.tibjms.TibjmsSession._createConsumer(Tib jmsSession.java:406)
      at com.tibco.tibjms.TibjmsSession.createConsumer(Tibj msSession.java:3032)
      at org.springframework.jms.listener.AbstractPollingMe ssageListenerContainer.createConsumer(AbstractPoll ingMessageListenerContainer.java:501)
      at org.springframework.jms.listener.AbstractPollingMe ssageListenerContainer.createListenerConsumer(Abst ractPollingMessageListenerContainer.java:223)
      at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.initRes ourcesIfNecessary(DefaultMessageListenerContainer. java:1081)
      at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.invokeL istener(DefaultMessageListenerContainer.java:1057)
      at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.execute OngoingLoop(DefaultMessageListenerContainer.java:1 050)
      at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.run(Def aultMessageListenerContainer.java:947)
      at java.lang.Thread.run(Thread.java:595)
      [19.07.2013 23:26:57] INFO: DefaultMessageListenerContainer.refreshConnectionU ntilSuccessful() - Successfully refreshed JMS Connection

      Comment


      • #4
        That seems to be a peculiarity of your JMS provider's implementation, using the name should return the destination - the container uses session.createQueue(queueName); and then creates a consumer on the destination that is returned - looks like they are returning a destination but then fail when you try to create a consumer on that destination - strange.

        Perhaps they require you to get the destination using JNDI instead of using session.createQueue().

        Comment


        • #5
          Thanks for the reply Gary.

          I'm not clear on -
          Perhaps they require you to get the destination using JNDI instead of using session.createQueue().
          Should i use a JNDI template and fetch the destination? In that case i would need to use a jms-template?
          How would i pass a jms-template to the <int-jms:message-driven-channel-adapter> as it accepts only a container.

          Should i use an <int-jms:inbound-channel-adapter> ?

          Regards,
          PD

          Comment


          • #6
            Resolved - Able to listen to messages from Dbus JMS Queue

            Hi Gary,
            Resolved the issue using JNDI and int-jms:inbound-channel-adapter.
            Please find the configuration below-

            Code:
            <bean id="inboundJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
                            <property name="connectionFactory" ref="inboundAuthenticationConnectionFactory" />
                            <property name="destinationResolver" ref="inboundJmsDestinationResolver" />
                            <property name="defaultDestination" ref="inboundDestination" />
                            <property name="receiveTimeout" value="${dbus.receive.timeout}" />
                            <property name="sessionTransacted" value="true" />
                    </bean>
                    <bean id="inboundJmsDestinationResolver"
                            class="org.springframework.jms.support.destination.JndiDestinationResolver">
                            <property name="jndiTemplate" ref="jndiTemplate" />
                            <property name="cache" value="true" />
                    </bean>
                    <bean id="inboundDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
                            <property name="jndiTemplate" ref="jndiTemplate" />
                            <property name="jndiName" value="${int.dbus.jms.inbound.queue}" />
                    </bean>
                    <bean id="inboundAuthenticationConnectionFactory"
                            class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
                            <property name="targetConnectionFactory" ref="inboundJmsConnectionFactory" />
                            <property name="username" value="${inbound.java.username}" />
                            <property name="password" value="${inbound.java.password}" />
                    </bean>
                    <bean id="inboundJmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
                            <property name="jndiTemplate" ref="jndiTemplate" />
                            <property name="jndiName" value="${int.dbus.jms.inbound.connectionfactory}" />
                    </bean>
            
                    <int-jms:inbound-channel-adapter
                            jms-template="inboundJmsTemplate" channel="com.hcl.jms.inbound"
                            extract-payload="true" destination-name="${int.dbus.jms.inbound.queue}">
                            <int:poller fixed-rate="1000" />
                    </int-jms:inbound-channel-adapter>
            My only concern is why cant i use Message Driven Channel adapter ? that way i can get the messages real time, than using a poller. Please advice.


            Regards,
            PD

            Comment


            • #7
              You should be able to simply inject 'inboundDestination' into the message-driven adapter (or the inbound adapter) using the 'destination' attribute, without using a destination resolver.

              If, for some reason, you MUST use a destination resolver, you can supply it to the message-driven adapter using the "destination-resolver" attribute.

              Comment


              • #8
                Thanks Gary, Had tried that but for some reason the connection establishment was not happening.
                Something to do with how Dbus Implementation i feel.

                Regards,
                PD

                Comment

                Working...
                X