0 Replies Latest reply on Aug 31, 2010 5:54 PM by victor Kazakov

    Changing jboss messaging login-module

    victor Kazakov Newbie

      Hi,

      I need to change the jboss messaging login module so that it obtains the correct username and password. But when i do I get errors starting jboss. I think it is because my custom login module is deployed after jboss messaging beans, but I am not sure. Any help or advice would be great. Thanks.

       

      I'm using JBOSS AS 5.1.0

       

      Below is my messaging-jboss-beans.xml file, my-destinations-service.xml, and the jobb log.

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      
      <!--
          Messaging beans
          $Id: messaging-jboss-beans.xml 88672 2009-05-11 20:49:47Z anil.saldhana@jboss.com $
      -->
      <deployment xmlns="urn:jboss:bean-deployer:2.0">
      
         <!-- messaging application-policy definition -->
         <application-policy xmlns="urn:jboss:security-beans:1.0" name="messaging">
            <authentication>
                <login-module code = "path.to.my.jaas.LoginModule"
                   flag = "required">
                   <!-- user-role mapping -->
                   <module-option name = "unauthenticatedIdentity">admin@email.com</module-option>
                   <module-option name = "dsJndiName">java:/MyConfigurationDS</module-option>
                   <module-option name = "principalsQuery">select password from user u inner join user_role ur on u.id=ur.user_id inner join authorization_role r on ur.role_id=r.id where u.email=? and u.status=2 and r.id=5</module-option>
                   <module-option name = "rolesQuery">select r.name as role, 'Roles' as role_group from user u inner join user_role ur on u.id=ur.user_id inner join authorization_role r on ur.role_id=r.id where u.email=? and u.status=2 and r.id=5</module-option>
                   <!-- password hashing -->
                   <module-option name="hashAlgorithm">HashType</module-option>
                   <module-option name="hashEncoding">HashEncoding</module-option>
                   <module-option name="hashCharset">UTF-8</module-option>
                </login-module>
            </authentication>
         </application-policy>
      
         <bean name="SecurityStore">
            <!-- default security configuration -->
            <property name="defaultSecurityConfig">
               <![CDATA[
                  <security>
                     <role name="guest" read="true" write="true" create="true"/>
                  </security>
               ]]>
            </property>
            <property name="suckerPassword">CHANGE ME!!</property>
            <property name="securityDomain">messaging</property>
            <property name="securityManagement"><inject bean="JNDIBasedSecurityManagement"/></property>
            <!-- @JMX annotation to export the management view of this bean -->
            <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.messaging:service=SecurityStore",exposedInterface=org.jboss.jms.server.jbosssx.JBossASSecurityMetadataStoreMBean.class)</annotation>
            <!-- Password Annotation to inject the password from the common password utility
             <annotation>@org.jboss.security.integration.password.Password(securityDomain="messaging",methodName="setSuckerPassword")</annotation>
             -->
         </bean>
      
         <bean name="MessagingDeploymentTemplateInfoFactory"
           />
      
         <bean name="QueueTemplate">
            <property name="info"><inject bean="QueueTemplateInfo"/></property>
         </bean>
         <bean name="QueueTemplateInfo"
           >
            <constructor factoryMethod="createTemplateInfo">
               <factory bean="DSDeploymentTemplateInfoFactory"/>
               <parameter>org.jboss.profileservice.management.templates.JmsDestinationTemplateInfo</parameter>
               <parameter>org.jboss.jms.server.destination.QueueServiceMO</parameter>
               <parameter>QueueTemplate</parameter>
               <parameter>A template for JMS queue *-service.xml deployments</parameter>
            </constructor>
            <property name="destinationType">QueueTemplate</property>
         </bean>
      
         <bean name="TopicTemplate">
            <property name="info"><inject bean="TopicTemplateInfo"/></property>
         </bean>
         <bean name="TopicTemplateInfo"
           >
            <constructor factoryMethod="createTemplateInfo">
               <factory bean="DSDeploymentTemplateInfoFactory"/>
               <parameter>org.jboss.profileservice.management.templates.JmsDestinationTemplateInfo</parameter>
               <parameter>org.jboss.jms.server.destination.TopicServiceMO</parameter>
               <parameter>TopicTemplate</parameter>
               <parameter>A template for JMS topic *-service.xml deployments</parameter>
            </constructor>
            <property name="destinationType">TopicTemplate</property>
         </bean>
      
      </deployment>
      
      
      
      <?xml version="1.0" encoding="UTF-8"?>
      
      <server>
      
        <mbean code="org.jboss.mq.server.jmx.Queue" name="jboss.mq.destination:service=Queue,name=removeUser">
          <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
        </mbean>
      </server>
      

       

       

      14:23:32,328 WARN  [JmsActivation] Failure in jms activation org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@125ff6c6(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@6e4d4b9d destination=queue/removeUser destinationType=javax.jms.Queue tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=5)
      javax.jms.JMSSecurityException: User: null is not authorized to read from destination removeUser
          at org.jboss.jms.server.container.SecurityAspect.check(SecurityAspect.java:312)
          at org.jboss.jms.server.container.SecurityAspect.handleCreateConsumerDelegate(SecurityAspect.java:112)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.jboss.aop.advice.PerInstanceAdvice.invoke(PerInstanceAdvice.java:122)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.jms.server.container.ServerLogInterceptor.invoke(ServerLogInterceptor.java:105)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.jms.server.endpoint.advised.SessionAdvised.createConsumerDelegate(SessionAdvised.java)
          at org.jboss.jms.wireformat.SessionCreateConsumerDelegateRequest.serverInvoke(SessionCreateConsumerDelegateRequest.java:100)
          at org.jboss.jms.server.remoting.JMSServerInvocationHandler.invoke(JMSServerInvocationHandler.java:143)
          at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
          at org.jboss.remoting.transport.local.LocalClientInvoker.invoke(LocalClientInvoker.java:106)
          at org.jboss.remoting.Client.invoke(Client.java:1724)
          at org.jboss.remoting.Client.invoke(Client.java:629)
          at org.jboss.remoting.Client.invoke(Client.java:617)
          at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:189)
          at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:160)
          at org.jboss.jms.client.delegate.ClientSessionDelegate.org$jboss$jms$client$delegate$ClientSessionDelegate$createConsumerDelegate$aop(ClientSessionDelegate.java:267)
          at org.jboss.jms.client.delegate.ClientSessionDelegate$createConsumerDelegate_8721389917985689973.invokeTarget(ClientSessionDelegate$createConsumerDelegate_8721389917985689973.java)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)
          at org.jboss.jms.client.container.StateCreationAspect.handleCreateConsumerDelegate(StateCreationAspect.java:142)
          at org.jboss.aop.advice.org.jboss.jms.client.container.StateCreationAspect_z_handleCreateConsumerDelegate_1627839533.invoke(StateCreationAspect_z_handleCreateConsumerDelegate_1627839533.java)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.jms.client.container.ConsumerAspect.handleCreateConsumerDelegate(ConsumerAspect.java:76)
          at org.jboss.aop.advice.org.jboss.jms.client.container.ConsumerAspect_z_handleCreateConsumerDelegate_1627839533.invoke(ConsumerAspect_z_handleCreateConsumerDelegate_1627839533.java)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.jms.client.container.FailoverValveInterceptor.invoke(FailoverValveInterceptor.java:92)
          at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)
          at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.jms.client.delegate.ClientSessionDelegate.createConsumerDelegate(ClientSessionDelegate.java)
          at org.jboss.jms.client.JBossConnectionConsumer.<init>(JBossConnectionConsumer.java:126)
          at org.jboss.jms.client.container.SessionAspect.handleCreateConnectionConsumer(SessionAspect.java:772)
          at org.jboss.aop.advice.org.jboss.jms.client.container.SessionAspect_z_handleCreateConnectionConsumer_1627839533.invoke(SessionAspect_z_handleCreateConnectionConsumer_1627839533.java)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)
          at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.jms.client.delegate.ClientConnectionDelegate.createConnectionConsumer(ClientConnectionDelegate.java)
          at org.jboss.jms.client.JBossConnection.createConnectionConsumer(JBossConnection.java:140)
          at org.jboss.resource.adapter.jms.inflow.JmsServerSessionPool.setupConsumer(JmsServerSessionPool.java:289)
          at org.jboss.resource.adapter.jms.inflow.JmsServerSessionPool.start(JmsServerSessionPool.java:89)
          at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupSessionPool(JmsActivation.java:656)
          at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:359)
          at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:729)
          at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:205)
          at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
          at java.lang.Thread.run(Thread.java:619)