geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yellowb <yell...@hotmail.fr>
Subject javax.ejb.EJBAccessException - Unauthorized Access by Principal Denied
Date Thu, 02 Dec 2010 16:26:56 GMT

Hi,

I'm trying to use authenticated remote ejb but it always fails with the
exception javax.ejb.EJBAccessException - Unauthorized Access by Principal
Denied

I've been browsing the web alot but I didn't found a solution.

i'm using Geronimo 2.1.7

here is the bean :

@Stateless
@DeclareRoles({"admin"})
@RolesAllowed({"admin"})
public class UserBean implements UserBeanRemote, UserBeanLocal {

    public UserBean() {
    }
   
    public String getName() {
    return "plout" ;
    }

}


Here is the client :

public class User {
        private String name="";

           public String getName() {
                   return name ;
           }

           public void setName(String name) {
              String n = "";
                        try {
                                Properties prop = new Properties();
                                prop.put("java.naming.factory.initial",
"org.apache.openejb.client.RemoteInitialContextFactory");
                                prop.put("java.naming.provider.url",
"ejbd://localhost:4201");
                                Context ctx= new InitialContext(prop);
                               
prop.setProperty("openejb.authentication.realmName", "geronimo-admin");
                               
prop.setProperty("java.naming.security.principal", "system");
                               
prop.setProperty("java.naming.security.credentials", "manager");
                                UserBeanRemote
u1=(UserBeanRemote)ctx.lookup("UserBeanRemote");
                                n = u1.getName();
                        } catch (NamingException ne) {
                                System.out.println(ne.toString());
                        }
                        this.name = n ;
           }
}

Here is the openejb-jar.xml :

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ejb:openejb-jar
        xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
       
xmlns:client="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0"
        xmlns:conn="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2"
        xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2"
        xmlns:ejb="http://openejb.apache.org/xml/ns/openejb-jar-2.2"
        xmlns:log="http://geronimo.apache.org/xml/ns/loginconfig-2.0"
        xmlns:name="http://geronimo.apache.org/xml/ns/naming-1.2"
        xmlns:pers="http://java.sun.com/xml/ns/persistence"
        xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1"
        xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0"
        xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
    <dep:environment>
        <dep:moduleId>
            <dep:groupId>default</dep:groupId>
            <dep:artifactId>pkb-ejb</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>car</dep:type>
       </dep:moduleId>
    </dep:environment>
        <sec:security>
                <sec:role-mappings>
                        <sec:role role-name="admin">
                                <sec:principal
class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"
name="admin"/>
                        </sec:role>
    </sec:role-mappings>
        </sec:security>
</ejb:openejb-jar>


Do you know where the problem come from or where I can find a good
documentation ?


Thanks


-- 
View this message in context: http://apache-geronimo.328035.n3.nabble.com/javax-ejb-EJBAccessException-Unauthorized-Access-by-Principal-Denied-tp2006827p2006827.html
Sent from the Users mailing list archive at Nabble.com.

Mime
View raw message