5 Replies Latest reply on Jan 5, 2004 7:10 AM by Adrian Brock

    Publishing messages from Stateless SessionBean security prob

    asinitsyn Newbie

      Hello,

      I'm trying to port application from Weblogic to JBoss and am stuck with problems publishing JMS messages from stateless session bean.

      Here is what I did. Please, advise those are valid changes:
      1. modified deploy/jms/jbossmq-service.xml to comment out old SecurityDomain and point to new one. This is for my MDBs to pass authentication.

      <mbean code="org.jboss.mq.security.SecurityManager" name="jboss.mq:service=SecurityManager">
       <attribute name="DefaultSecurityConfig">
       <security>
       <role name="guest" read="true" write="true" create="true"/>
       </security>
       </attribute>
       <!--attribute name="SecurityDomain">jbossmq</attribute-->
       <attribute name="SecurityDomain">DBRealm</attribute>
       <depends optional-attribute-name="NextInterceptor">jboss.mq:service=DestinationManager</depends>
       </mbean>

      2. modified deploy/jms/jms-ds.xml to comment out old SecurityDomain and point to new one. This is for UpdatePublisher to pass authentication.
      UpdatePublisher is session bean that sends messages. If I don't do it, I get exception saying "user guest is NOT authenticated"

      <tx-connection-factory>
      
       <jndi-name>JmsXA</jndi-name>
      
       <xa-transaction/>
       <!--track-connection-by-tx/-->
      
       <adapter-display-name>JMS Adapter</adapter-display-name>
      
       <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
      
       <!--security-domain-and-application>JmsXARealm</security-domain-and-application-->
       <security-domain-and-application>DBRealm</security-domain-and-application>
      
       </tx-connection-factory

      3. Here is relevant part of ejb-jar.xml
      <resource-ref>
       <res-ref-name>jms/TopicConnectionFactory</res-ref-name>
       <res-type>javax.jms.TopicConnectionFactory</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>

      4. Here is relevant part of jboss.xml
      <resource-ref>
       <res-ref-name>jms/TopicConnectionFactory</res-ref-name>
       <jndi-name>java:/JmsXA</jndi-name>
       </resource-ref>


      Finally when UpdatePublisher tries to createSession I get the following exception:
      2003-12-26 15:22:34,321 WARN [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection:
      javax.resource.spi.SecurityException: No Passwdord credentials found
      at org.jboss.resource.adapter.jms.JmsCred.getJmsCred(JmsCred.java:74)
      at org.jboss.resource.adapter.jms.JmsManagedConnectionFactory.createManagedConnection(JmsManagedConnectionFactory.java:92)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:451)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:212)
      at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:496)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:425)
      at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:318)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:477)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:814)
      at org.jboss.resource.adapter.jms.JmsSessionFactoryImpl.createTopicSession(JmsSessionFactoryImpl.java:159)
      at com.alantek.ejb.msgdistribution.UpdatePublisherBean.publishMessage(UpdatePublisherBean.java:188)

      Please, advise how to get SessionBean to publish several messages to Topics/Queues from within the same transaction.

      Thatnks in advance,
      Andrew