Boa tarde a todos…
Já li muitos fórom a fim de tentar resolver meu problema. Se alguém souber me disser qual o problema, fico grato.
Estou usando o GlassFish 3.1.2, e criei um JDBCRealm para autenticação. No meu EJB adicionei a seguinte anotação:
Em meu EAR onde encontra-se meu EJB adicionei ao diretório META-INF o arquivo glassfish-application.xml, com o seguinte conteudo:
[code]<?xml version="1.0" encoding="UTF-8"?>
default [/code]O deploi é feito sem erro nenhum.
No client tenho o arquivo auth.conf com o seguinte conteúdo:
default {
com.sun.enterprise.security.auth.login.ClientPasswordLoginModule required debug=false;
};
E finalmente tenho o meu loockup no cliente:
[code]Properties properties = new Properties();
System.setProperty("java.security.auth.login.config", ContextHelper.class.getResource("/auth.conf").getPath());
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory");
properties.setProperty(Context.URL_PKG_PREFIXES, "com.sun.enterprise.naming");
properties.setProperty(Context.STATE_FACTORIES, "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
properties.setProperty(Context.PROVIDER_URL, "localhost:3700");
ProgrammaticLogin programmaticLogin = new ProgrammaticLogin();
programmaticLogin.login("usuario","senha".toCharArray());
InitialContext ctx = new InitialContext(properties);
ctx.lookup("java:global/appName/moduleName/beanName!interfaceName");[/code]
Ao fazer o lookup tenho erro tanto no client como no servidor.
Client:
15:32:40,756 INFO ContextHelper:21 - connect url=null:null
[Root exception is java.rmi.AccessException: CORBA NO_PERMISSION 0 No; nested exception is:
org.omg.CORBA.NO_PERMISSION: ----------BEGIN server-side stack trace----------
Server (apenas isso):
Será que alguém tem alguma idéia do que possa estar errado?
Agradeço a todos que se interessarem pelo assunto.
[color=red]obs: se remover a anotação @RolesAllowed({“S”, “A”, “U”}) funciona corretamente.[/color]