[jboss-jira] [JBoss JIRA] (EJBTHREE-2254) @Singleton does not work with @RunAs/@RolesAllowed from an MDB (@Service works fine)

henk de boer (Commented) (JIRA) jira-events at lists.jboss.org
Sun Nov 20 12:44:40 EST 2011


    [ https://issues.jboss.org/browse/EJBTHREE-2254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644195#comment-12644195 ] 

henk de boer commented on EJBTHREE-2254:
----------------------------------------

Thanks for the test case. One thing I'm wondering about is the injection of the @Service annotated bean in the MDB. You're using the following code for this:

{code}
@EJB
private IRunAsTestServiceBean	mRunAsTestServiceBean;
{code}

But isn't it impossible to inject such a bean with @EJB? Did you download and run the attached test case to be 100% sure it's the right one?

When I run the ear on JBoss AS 6.10, I get the following exception:

{code}
Caused by: javax.naming.NameNotFoundException: RunAsTestServiceBean not bound
	at org.jnp.server.NamingServer.getBinding(NamingServer.java:771) [:5.0.5.Final]
	at org.jnp.server.NamingServer.getBinding(NamingServer.java:779) [:5.0.5.Final]
	at org.jnp.server.NamingServer.getObject(NamingServer.java:785) [:5.0.5.Final]
	at org.jnp.server.NamingServer.lookup(NamingServer.java:396) [:5.0.5.Final]
	at org.jnp.server.NamingServer.lookup(NamingServer.java:399) [:5.0.5.Final]
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728) [:5.0.5.Final]
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688) [:5.0.5.Final]
	at javax.naming.InitialContext.lookup(InitialContext.java:392) [:1.6.0_20]
	at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1350) [:5.0.5.Final]
{code}

{quote}
Note: please change the security-domain defined in jboss.xml to be, say, <security-domain>JBossWS</security-domain>
{quote}

Why is this needed? It's currently {{avant-ss}}, why would another name be needed?




                
> @Singleton does not work with @RunAs/@RolesAllowed from an MDB (@Service works fine)
> ------------------------------------------------------------------------------------
>
>                 Key: EJBTHREE-2254
>                 URL: https://issues.jboss.org/browse/EJBTHREE-2254
>             Project: EJB 3.0
>          Issue Type: Bug
>         Environment: JBoss 6.0.0.Final
>            Reporter: Richard Kennard
>         Attachments: RunAsTest.zip
>
>
> Test case attached. Please open as an Eclispe JBoss Tools project. It creates a Quartz-based MDB that tries to call various other beans (Session, Service and Singleton) that are secured with @RolesAllowed. To allow this, it uses @RunAs.
> To observe the behaviour:
> 1. Deploy the app. Notice that the MDB (which triggers every minute) can successfully run the secured methods from the Session bean and the Service bean, but NOT the Singleton bean. The @RunAs credentials are not being passed to the @Singleton bean
> 2. Uncomment the lines indicated in the code (in RunAsTestMDB.java and jboss.xml). This sets a null security-domain on the Singleton bean, allowing it to be invoked. However immediately afterwards the MDB's @RunAs credentials are lost and it can no longer call the Session bean

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list