Gate-IN + JBoss 5.1 + JAAS
gregtk Mar 31, 2011 11:06 PMHello guys! I got in trouble with integrating my application and Gate-IN.
I have EAR which contains my EJB3 beans and WAR with my portlet for gate-in. In jboss-app.xml I have:
<!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd"> <jboss-app> <security-domain>java:/jaas/gatein-domain</security-domain> </jboss-app>
When I deploy my ear on Gate-IN everything work fine. I can call ejb methods from my portlet, and in ejb I can access getCallerPrincipal() and get the same user which authorized in Portal. But sometimes I catch exception when I call methods of my EJB:
Caused by: javax.ejb.EJBAccessException: Invalid User at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:165) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:421) at org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:85) at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62) at $Proxy455.invoke(Unknown Source) at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207) at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
And I don't understand why, because another parts of portal working right. After I catch this exception only helps re-login to get functionality back.
This is example of code how I have access to my EJB from portlet:
Hashtable<String, String> environment = new Hashtable<String, String>(); environment.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); environment.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); environment.put("java.naming.provider.url", "localhost:1099"; Context jndiContext = new InitialContext(environment); Object ref = jndiContext.lookup("simpl-pj/AccessDocBean/remote");
Please, somebody explain me what I'm doing wrong?