It works with a security interceptor on the mdb. See the
org.jboss.test.security.test.EJBSpecUnitTestCase unit
test setup for an example.
xxxxxxxxxxxxxxxxxxxxxxxx
Scott Stark
Chief Technology Officer
JBoss Group, LLC
xxxxxxxxxxxxxxxxxxxxxxxx
----- Original Message -----
From: "Stephen Coy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 29, 2002 7:44 PM
Subject: Re: [JBoss-user] Security and Message Driven Beans
> Does "run-as" not work yet?
>
> My MDB is now receiving messages, but I get authentication exceptions as
> soon as I access an EJB's finder:
>
> 12:34:56,766 INFO [AgreementFacadeBean] Submitting agreement 20000485
> for assessment
> 12:34:57,021 INFO [ProcessorBean] Commencing processing of agreement:
> 20000485
> 12:34:57,049 ERROR [SecurityInterceptor] Authentication exception,
> principal=null
> 12:34:57,052 ERROR [ProcessorBean]
> java.lang.reflect.UndeclaredThrowableException
> 12:34:57,055 ERROR [ProcessorBean] javax.ejb.EJBException: null
> Embedded Exception
> null
> 12:34:57,127 ERROR [LogInterceptor] TransactionRolledbackException,
> causedBy:
> javax.ejb.EJBException: null
> Embedded Exception
> null
> at
> com.whitesmiths.sacha.ejb.assessment.ProcessorBean.onMessage(Unknown
> Source)
> at java.lang.reflect.Method.invoke(Native Method)
> at
> org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke
> (MessageDrivenContainer.java:391)
> at
> org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke
> (CachedConnectionInterceptor.java:147)
> at
> org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke
> (MessageDrivenInstanceInterceptor.java:88)
> at
> org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext
> (AbstractTxInterceptor.java:96)
> at
> org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions
> (TxInterceptorCMT.java:142)
> at
> org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
> at
> org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
> at
>
org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:302)
> at
>
org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.jav
a:
> 625)
> at
>
org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(
> JMSContainerInvoker.java:973)
> at
> org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:234)
> at
> org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage
> (SpyMessageConsumer.java:560)
> at
> org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:377)
> at org.jboss.mq.SpySession.run(SpySession.java:220)
> at
> org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:173)
> at
> EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run
> (PooledExecutor.java:642)
> at java.lang.Thread.run(Thread.java:496)
> java.rmi.RemoteException: checkSecurityAssociation; nested exception is:
> java.lang.SecurityException: Authentication exception,
> principal=null
> java.lang.SecurityException: Authentication exception, principal=null
> at
> org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityAssociation
> (SecurityInterceptor.java:169)
> at
>
org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.jav
a:
> 93)
> at
> org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
> at
> org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
> at
> org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invokeHome
> (BaseLocalContainerInvoker.java:227)
> at
> org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
> at $Proxy96.findByPrimaryKey(Unknown Source)
> at
> com.whitesmiths.sacha.ejb.assessment.ProcessorBean.onMessage(Unknown
> Source)
> at java.lang.reflect.Method.invoke(Native Method)
> at
> org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke
> (MessageDrivenContainer.java:391)
> at
> org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke
> (CachedConnectionInterceptor.java:147)
> at
> org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke
> (MessageDrivenInstanceInterceptor.java:88)
> at
> org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext
> (AbstractTxInterceptor.java:96)
> at
> org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions
> (TxInterceptorCMT.java:142)
> at
> org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
> at
> org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
> at
>
org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:302)
> at
>
org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.jav
a:
> 625)
> at
>
org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(
> JMSContainerInvoker.java:973)
> at
> org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:234)
> at
> org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage
> (SpyMessageConsumer.java:560)
> at
> org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:377)
> at org.jboss.mq.SpySession.run(SpySession.java:220)
> at
> org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:173)
> at
> EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run
> (PooledExecutor.java:642)
> at java.lang.Thread.run(Thread.java:496)
>
> On Thursday, May 30, 2002, at 11:20 AM, Scott M Stark wrote:
>
> > Actually the 3.0 release will include a stripped down security
> > interceptor
> > for MDBs that just supports the run-as functionality.
> >
> > xxxxxxxxxxxxxxxxxxxxxxxx
> > Scott Stark
> > Chief Technology Officer
> > JBoss Group, LLC
> > xxxxxxxxxxxxxxxxxxxxxxxx
> > ----- Original Message -----
> > From: "Stephen Coy" <[EMAIL PROTECTED]>
> > To: "jboss-user" <[EMAIL PROTECTED]>
> > Sent: Wednesday, May 29, 2002 5:11 PM
> > Subject: [JBoss-user] Security and Message Driven Beans
> >
> >
> >> Hi,
> >>
> >>
> >> I am using JBoss 3.0RC3.
> >>
> >> I've got a stateful session bean which is associated with a Principal
> >> that has been authenticated in our application's security domain.
> >> When I
> >> try to send a message to a queue based MDB, I get the following
> >> exception:
> >>
> >> 18:14:00,821 INFO [AgreementFacadeBean] Submitting agreement 20000416
> >> for assessment
> >> 18:14:01,087 ERROR [SecurityInterceptor] Authentication exception,
> >> principal=null
> >> 18:14:01,089 ERROR [JMSContainerInvoker] Exception in JMSCI message
> >> listener
> >> java.rmi.RemoteException: checkSecurityAssociation; nested exception
> >> is:
> >> java.lang.SecurityException: Authentication exception,
> >> principal=null
> >> java.lang.SecurityException: Authentication exception, principal=null
> >> at
> >> org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityAssociation
> >> (SecurityInterceptor.java:169)
> >> at
> >>
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:
> >> 118)
> >> at
> >> org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
> >> at
> >>
> >
org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:302)
> >> at
> >>
> > org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke
> > (JMSContainerInvoker.jav
> > a:
> >> 625)
> >> at
> >>
> >
org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(
> >> JMSContainerInvoker.java:973)
> >> at
> >> org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:234)
> >> at
> >> org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage
> >> (SpyMessageConsumer.java:560)
> >> at
> >> org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:377)
> >> at org.jboss.mq.SpySession.run(SpySession.java:220)
> >> at
> >> org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:173)
> >> at
> >> EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run
> >> (PooledExecutor.java:642)
> >> at java.lang.Thread.run(Thread.java:496)
> >>
> >> My queue is set up as follows in jbossmq-destinations-service.xml:
> >>
> >> <mbean code="org.jboss.mq.server.jmx.Queue"
> >> name="jboss.mq.destination:service=Queue,name=AssessmentQueue">
> >> <depends optional-attribute-
> >> name="DestinationManager">jboss.mq:service=DestinationManager</depends>
> >> </mbean>
> >>
> >> and the code to send the message:
> >>
> >> // Grab a reference to the assessment queue and create a
> >> connection to it.
> >> QueueConnectionFactory factory =
> >> (QueueConnectionFactory)mJMSContext.lookup(QUEUE_FACTORY_NAME);
> >> Queue queue = (Queue)mJMSContext.lookup(queueName);
> >> QueueConnection queueConnection = factory.createQueueConnection();
> >> try
> >> {
> >> // Create a queue session and a queue sender to forward our message
> >> QueueSession queueSession =
> >> queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
> >> QueueSender queueSender = queueSession.createSender(queue);
> >>
> >> // Create an ObjectMessage to hold the agreement refnum so
> >> that it can
> >> // be transmitted to the assessment processor.
> >> ObjectMessage anObjectMessage = queueSession.createObjectMessage();
> >> anObjectMessage.setObject(agreement.getRefNum());
> >>
> >> queueSender.send(anObjectMessage);
> >> }
> >> finally
> >> {
> >> queueConnection.close();
> >> }
> >>
> >> Any pointers or tips would be greatly appreciated!
> >>
> >> Thanks,
> >>
> >> Steve Coy
> >>
> >>
> >> _______________________________________________________________
> >>
> >> Don't miss the 2002 Sprint PCS Application Developer's Conference
> >> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
> >>
> >> _______________________________________________
> >> JBoss-user mailing list
> >> [EMAIL PROTECTED]
> >> https://lists.sourceforge.net/lists/listinfo/jboss-user
> >>
> >
> >
> > _______________________________________________________________
> >
> > Don't miss the 2002 Sprint PCS Application Developer's Conference
> > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
> >
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/jboss-user
>
>
> _______________________________________________________________
>
> Don't miss the 2002 Sprint PCS Application Developer's Conference
> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
>
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user