geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cvx22 <>
Subject isCallerInRole(...) always return false
Date Tue, 18 Dec 2007 20:54:49 GMT

Hi gurus,

I'm just starting my experience with javaee and apache Geronimo. The first
is EJB. I created simple session bean based on MyPhonebookBean from
Geronimo's pages. I spen't much time on login configuration and it works.
now i have a problem with <context>.isCallerInRole().
Each time I invoke this method on SessionContext, it return false. 
getCallerPrincipal method works correctly.

@RolesAllowed("Reader") works correctly. without client authorizations I
can't invoke this method. 
The strange thing is, ctx.isCallerInRole("Reader") returns false. I really
don't now why.
Why @RolesAllowed is ok, but isCallerInRole not.
I think this may be some configuration error or bug. 
I have no idea where is problem. Last thing I wish to do, is source code
debugging, started it, but it is hard work and until now didn't found any
I need this method working correctly for beans, which I plan to write.

thanks for help.

Geronimo is 2.0.2.
more about code:
I use standalone ejb client. there is most important part of code:
	Properties env = new Properties();
	String jndiProvider =
	env.put( Context.INITIAL_CONTEXT_FACTORY , jndiProvider);
	env.put( Context.PROVIDER_URL, "tcp://");
	env.put( Context.SECURITY_PRINCIPAL, "user");
	env.put( Context.SECURITY_CREDENTIALS, "password");
	env.put( "openejb.authentication.realmName", "test-realm");
	try {
		Context ctx = new InitialContext(env);
	    Object obj = ctx.lookup( "MyPhonebookBeanRemote");
	    System.out.println("Accessing: "+obj.getClass());
	    MyPhonebookRemote pbr = (MyPhonebookRemote) obj;
	    PhoneBook b = pbr.findByPrimaryKey("Joe");
in MyPhonebookBean class i have method:
where SessionContext ctx;
        public PhoneBook findByPrimaryKey(String name) {
                EntityManager em = emf.createEntityManager();
in openejb-jar.xml there is just:
threre is also security realm description "test-ream" cooperating with
MySQL. it works correctly (i.e. if i chage password in DB, user can't login)
        <security xmlns="">
                        <role role-name="Reader">

View this message in context:
Sent from the Apache Geronimo - Users mailing list archive at

View raw message