2 Replies Latest reply on May 12, 2005 1:23 PM by Nitin Shreyakar

    RunAsMDB

    Simone Newbie

      Hi,

      I have an MDB that has to call an EJB that leaves in a different jar file in the same ear. Now I need to set run-as a role to call my EJB. I lloked at the est EJB but I had still no luck. Here is my descriptor:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      
      <ejb-jar >
      
       <description>[CDATA[No Description.]]</description>
       <display-name>Generated by XDoclet</display-name>
      
       <enterprise-beans>
      
       <!-- Session Beans -->
       <!--
       To add session beans that you have deployment descriptor info for, add
       a file to your XDoclet merge directory called session-beans.xml that contains
       the <session></session> markup for those beans.
       -->
      
       <!-- Entity Beans -->
       <!--
       To add entity beans that you have deployment descriptor info for, add
       a file to your XDoclet merge directory called entity-beans.xml that contains
       the <entity></entity> markup for those beans.
       -->
      
       <!-- Message Driven Beans -->
       <message-driven >
       <description>[CDATA[A message-driven bean based on a Queue that collect pricing Jobs]]</description>
      
       <ejb-name>JobsCollector</ejb-name>
      
       <ejb-class>com.db.gm.risk.ejb.message.pricer.JobsCollectorBean</ejb-class>
      
       <transaction-type>Container</transaction-type>
       <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
       <message-driven-destination>
       <destination-type>javax.jms.Queue</destination-type>
       <subscription-durability>NonDurable</subscription-durability>
       </message-driven-destination>
      
       <ejb-local-ref >
       <ejb-ref-name>ejb/JobFacade</ejb-ref-name>
       <ejb-ref-type>Session</ejb-ref-type>
       <local-home>com.db.gm.risk.ejb.session.pricer.JobFacadeLocalHome</local-home>
       <local>com.db.gm.risk.ejb.session.pricer.JobFacadeLocal</local>
       <ejb-link>JobFacade</ejb-link>
       </ejb-local-ref>
      
       <security-identity>
       <run-as>
       <role-name>realRole</role-name>
       </run-as>
       </security-identity>
      
       </message-driven>
      
       <!--
       To add message driven beans that you have deployment descriptor info for, add
       a file to your XDoclet merge directory called message-driven-beans.xml that contains
       the <message-driven></message-driven> markup for those beans.
       -->
      
       </enterprise-beans>
      
       <!-- Relationships -->
      
       <!-- Assembly Descriptor -->
       <assembly-descriptor >
       <!--
       To add additional assembly descriptor info here, add a file to your
       XDoclet merge directory called assembly-descriptor.xml that contains
       the <assembly-descriptor></assembly-descriptor> markup.
       -->
      
       <!-- finder permissions -->
      
       <!-- transactions -->
      
       <!-- finder transactions -->
       </assembly-descriptor>
      
      </ejb-jar>
      
      


      And my exception:

      2004-05-18 17:58:36,666 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Current transaction in MI is null
      2004-05-18 17:58:36,666 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TX_NOT_SUPPORTED for onMessage
      2004-05-18 17:58:36,666 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Thread came in with tx null
      2004-05-18 17:58:36,666 TRACE [org.jboss.ejb.plugins.MessageDrivenInstancePool] Get instance org.jboss.ejb.plugins.MessageDrivenInstancePool@12d0430#0#class com.db.gm.risk.ejb.message.pricer.JobsCollectorBean
      2004-05-18 17:58:36,697 INFO [com.db.gm.risk.ejb.message.pricer.JobsCollectorBean] Message received: ciao
      2004-05-18 17:58:36,697 INFO [JNDILookup] Created JNDILookup
      2004-05-18 17:58:36,697 TRACE [org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor] invokerBInding is null in ProxyFactoryFinder
      2004-05-18 17:58:36,697 TRACE [org.jboss.ejb.plugins.LogInterceptor] Start method=create
      2004-05-18 17:58:36,697 INFO [com.db.gm.risk.jboss.server.jaas.TsarLoginModule] tsarUrl: jboss.jca:service=TxCM,name=JmsXA
      2004-05-18 17:58:36,697 DEBUG [com.db.gm.risk.jboss.server.jaas.TsarLoginModule] Bad password for username=null
      2004-05-18 17:58:36,713 ERROR [org.jboss.ejb.plugins.SecurityInterceptor] Authentication exception, principal=null
      2004-05-18 17:58:36,713 ERROR [org.jboss.ejb.plugins.LogInterceptor] EJBException, causedBy:
      java.lang.SecurityException: Authentication exception, principal=null
       at org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityAssociation(SecurityInterceptor.java:164)
       at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:81)
       at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
       at org.jboss.ejb.StatelessSessionContainer.internalInvokeHome(StatelessSessionContainer.java:319)
       at org.jboss.ejb.Container.invoke(Container.java:720)
       at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:293)
       at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
       at $Proxy45.create(Unknown Source)
       at com.db.gm.risk.ejb.message.pricer.JobsCollectorBean.onMessage(Unknown Source)
       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:324)
       at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:460)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
       at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:62)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:240)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
       at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:90)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
       at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:374)
       at org.jboss.ejb.Container.invoke(Container.java:700)
       at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:824)
       at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1114)
       at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
       at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:633)
       at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:433)
       at org.jboss.mq.SpySession.run(SpySession.java:298)
       at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
       at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:727)
       at java.lang.Thread.run(Thread.java:534)
      2004-05-18 17:58:36,728 TRACE [org.jboss.ejb.plugins.LogInterceptor] End method=create
      2004-05-18 17:58:36,728 ERROR [com.db.gm.risk.ejb.message.pricer.JobsCollectorBean] Error processing message: checkSecurityAssociation; CausedByException is:
       Authentication exception, principal=null
      2004-05-18 17:58:36,728 TRACE [org.jboss.ejb.plugins.MessageDrivenInstancePool] 0/100 Free instance:org.jboss.ejb.plugins.MessageDrivenInstancePool@12d0430#null#null#true#class com.db.gm.risk.ejb.message.pricer.JobsCollectorBean
      2004-05-18 17:58:36,728 TRACE [org.jboss.ejb.plugins.LogInterceptor] End method=onMessage
      
      

      Anyone any idea?

      Many thanks!!!!

        • 1. Re: RunAsMDB
          Simone Newbie

          Looking at the forum I found my solution. Need to edit login-config.xml

           <application-policy name = "test">
           <authentication>
           <login-module code="com.db.gm.risk.jboss.server.jaas.TsarLoginModule" flag = "sufficient">
           <module-option name = "tsarUrl">jboss.jca:service=TxCM,name=JmsXA</module-option>
           </login-module>
          <login-module code = "org.jboss.security.ClientLoginModule"
           flag = "required">
           </login-module>
           </authentication>
           </application-policy>
          


          And add / modify the red part.

          Simone

          • 2. Re: RunAsMDB
            Nitin Shreyakar Newbie

            Hi,

            Thanks a lot. It worked for me.

            Regards,
            Nitin.