[jboss-user] [EJB3] - Konfiguratio of security domains in JBoss AS 6 with EJB 3.1

Süleyman Vurucu do-not-reply at jboss.com
Fri Nov 5 10:07:09 EDT 2010

Süleyman Vurucu [http://community.jboss.org/people/suikast42] created the discussion

"Konfiguratio of security domains in JBoss AS 6 with EJB 3.1"

To view the discussion, visit: http://community.jboss.org/message/569827#569827

Hi @ all,

My Environment at first:

Aplication Sevrer :      jboss- (default configuration without any changes)
IDE:                          Eclipse 3.6
Jboss Tools               V 3.2
Java Version:             JDK 1.6 U 20
OS:                          Windows Vista 32 Bit

My Problem:

I Create a test Application. It Contains only one Stateless Bean with local and remote interfaces:

*package* beans.stateless;
*import* interfaces.stateless.FirstStatelessBeanLocal;
*import* interfaces.stateless.FirstStatelessBeanRemote;
*import* javax.annotation.*;
*import* javax.annotation.security.*;
*import* javax.ejb.*;
*import* org.apache.commons.logging.*;
*import* org.jboss.aop.*;
*import* org.jboss.beans.metadata.api.annotations.*;
*import* org.jboss.security.annotation.*;
 * Session Bean implementation class FirstStatelessBean
*public* *class* FirstStatelessBean *implements* FirstStatelessBeanRemote, FirstStatelessBeanLocal {
     * Default constructor.
    *private* int    pCounterLocal    = 0;
    *private* int    pCounterRemote    = 0;
    *private* SessionContext myCtx ; 
    *public* FirstStatelessBean() {
    *public* *void* destroy() {
        LogFactory.getLog( getClass() ).warn( "Destroy" );
    *public* *void* create(){
        LogFactory.getLog( getClass() ).warn( "Create" );
    *public* String sayHelloLocal( String pMesssage ) {
        String lMessage = "Hello Local to " + pMesssage + " " + ( ++pCounterLocal ) + " Times";
        LogFactory.getLog( getClass() ).info( lMessage );
        *return* lMessage;
    *public* String sayHelloRemote( String pMesssage ) {
        String lMessage = "Hello Remote to " + pMesssage + " " + ( ++pCounterRemote ) + " Times";
        LogFactory.getLog( getClass() ).info( lMessage );
//      LogFactory.getLog( getClass() ).info( myCtx.getCallerPrincipal() );
        *return* lMessage;
    *public* *void* passviate() {
        LogFactory.getLog( getClass() ).warn( "Passivate" );        

On The Client side I get the JNDI Refrence on the following way:

Properties p = *new* Properties();
                p.put( Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" );
                p.put( Context.PROVIDER_URL, "jnp://" + pServerAddr + ":" + pServerPort );
InitialContext jndiContext = *new* InitialContext( p );

So  my excpected behavior (when I call sayHelloRemote) is an Exception. But  this request still works with worong user information.

So what I'm doing wrong ?

I try the example from
http://community.jboss.org/wiki/Chapter15-SecurityandSchoolEJBAccess (http://community.jboss.org/docs/DOC-15571) as well. But the result i the same. I can call every method withaout an exception. And when I call getCallerPrincipal from SessionContext I get an Exception. This occurs while the bean don't in a security domain am I rigth ?

Reply to this message by going to Community

Start a new discussion in EJB3 at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101105/90299180/attachment.html 

More information about the jboss-user mailing list