2 Replies Latest reply: Jun 8, 2012 6:57 PM by Niharika Bajaj RSS

NotContextException when looking up Autenticator

Niharika Bajaj Newbie

Hi,

 

I'm migrating from Jboss 4.2.2 to 7.1.1. I'm using Seam 2, jsf facelets 1.1.11 and richfaces 3.2.2. The server starts up without any errors. It displays JNDI bindings for AutenticatorAction. AuthenticatorAction has authenticate method which authenticates the user. When it tries to authenticate, I get a NotContextException.

 

Here are the details.

 

14:47:28,692 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-5) JNDI bindings for session bean named AuthenticatorAction in deployment unit subdeployment "emsi.jar" of deployment "emsi.ear" are as follows:

        java:global/emsi/emsi.jar/AuthenticatorAction!org.partners.betr.emsi.seam.Authenticator
        java:app/emsi.jar/AuthenticatorAction!org.partners.betr.emsi.seam.Authenticator
        java:module/AuthenticatorAction!org.partners.betr.emsi.seam.Authenticator
        java:global/emsi/emsi.jar/AuthenticatorAction
        java:app/emsi.jar/AuthenticatorAction
        java:module/AuthenticatorAction

 

Authenticator/Action are packaged inside emsi.jar

 

Authenticator.java

 

package org.partners.betr.emsi.seam;

 

import javax.ejb.Local;

 

@Local
public interface Authenticator
{
   boolean authenticate();
}

 

AuthenticatorAction.java

 

package org.partners.betr.emsi.seam;

 

@Stateless
@Name("authenticator")
public class AuthenticatorAction implements Authenticator {

   @Out(required=false, scope = SESSION)
   private User user;
  
   private static final Log sLog = LogFactory.getLog(AuthenticatorAction.class);
  
@EJB
private UserManagement mUserManagement;
  
   public boolean authenticate() {
   
    String lUsername = Identity.instance().getCredentials().getUsername();
    String lPassword = Identity.instance().getCredentials().getPassword();
   
    User lUser = mUserManagement.validateUser(lUsername, lPassword);
   
    if (lUser != null && lUser instanceof Admin) {
     user = lUser;
     return true;
    }
    else
     return false;

   }

}

 

Stacktrace:

 

15:19:11,700 ERROR [org.jboss.seam.security.jaas.SeamLoginModule] (http-localhost-127.0.0.1-8080-5) Error invoking login method: org.jboss.seam.InstantiationException: Could not instantiate S

        at org.jboss.seam.Component.newInstance(Component.java:2041) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.Component.getInstance(Component.java:1923) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.Component.getInstance(Component.java:1890) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53) [jboss-seam.jar:2.1.0.BETA1]

        at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.1.7-jbossorg-2.jar:]

        at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.1.7-jbossorg-2.jar:]

        at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44) [jboss-el-1.0_02.CR2.jar:1.0_02.CR2]

        at org.jboss.el.parser.AstValue.getTarget(AstValue.java:34) [jboss-el-1.0_02.CR2.jar:1.0_02.CR2]

        at org.jboss.el.parser.AstValue.invoke(AstValue.java:95) [jboss-el-1.0_02.CR2.jar:1.0_02.CR2]

        at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) [jboss-el-1.0_02.CR2.jar:1.0_02.CR2]

        at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:174) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:109) [jboss-seam.jar:2.1.0.BETA1]

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_19]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_19]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_19]

        at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_19]

        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769) [rt.jar:1.6.0_19]

        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186) [rt.jar:1.6.0_19]

        at javax.security.auth.login.LoginContext$5.run(LoginContext.java:706) [rt.jar:1.6.0_19]

        at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.6.0_19]

        at javax.security.auth.login.LoginContext.invokeCreatorPriv(LoginContext.java:703) [rt.jar:1.6.0_19]

        at javax.security.auth.login.LoginContext.login(LoginContext.java:575) [rt.jar:1.6.0_19]

        at org.jboss.seam.security.Identity.authenticate(Identity.java:317) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.security.Identity.authenticate(Identity.java:306) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.security.Identity.login(Identity.java:235) [jboss-seam.jar:2.1.0.BETA1]

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_19]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_19]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_19]

        at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_19]

        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329) [jboss-el-1.0_02.CR2.jar:1.0_02.CR2]

        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342) [jboss-el-1.0_02.CR2.jar:1.0_02.CR2]

        at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58) [jboss-el-1.0_02.CR2.jar:1.0_02.CR2]

        at org.jboss.el.parser.AstValue.invoke(AstValue.java:96) [jboss-el-1.0_02.CR2.jar:1.0_02.CR2]

        at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) [jboss-el-1.0_02.CR2.jar:1.0_02.CR2]

        at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68) [jsf-facelets-1.1.11-classpath15B1.jar:1.1.11]

        at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

        at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) [jsf-impl-2.1.7-jbossorg-2.jar:]

        at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

        at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321) [richfaces-impl-3.2.2.GA.jar:3.2.2.GA]

        at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296) [richfaces-impl-3.2.2.GA.jar:3.2.2.GA]

        at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253) [richfaces-impl-3.2.2.GA.jar:3.2.2.GA]

        at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466) [richfaces-impl-3.2.2.GA.jar:3.2.2.GA]

        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [jsf-impl-2.1.7-jbossorg-2.jar:]

        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.7-jbossorg-2.jar:]

        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:]

        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.1.0.BETA1]

        at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177) [richfaces-impl-3.2.2.GA.jar:3.2.2.GA]

        at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267) [richfaces-impl-3.2.2.GA.jar:3.2.2.GA]

        at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380) [richfaces-impl-3.2.2.GA.jar:3.2.2.GA]

        at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507) [richfaces-impl-3.2.2.GA.jar:3.2.2.GA]

        at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [jboss-seam.jar:2.1.0.BETA1]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]

        at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]

        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]

        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]

        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

        at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_19]

Caused by: javax.naming.NotContextException: emsi/emsi.jar/AuthenticatorAction

        at org.jboss.as.naming.util.NamingUtils.notAContextException(NamingUtils.java:140)

        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:197)

        at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:123)

        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)

        at javax.naming.InitialContext.lookup(InitialContext.java:392) [rt.jar:1.6.0_19]

        at org.jboss.seam.Component.instantiateSessionBean(Component.java:1312) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.Component.instantiate(Component.java:1276) [jboss-seam.jar:2.1.0.BETA1]

        at org.jboss.seam.Component.newInstance(Component.java:2019) [jboss-seam.jar:2.1.0.BETA1]

        ... 82 more

 

 

Contents of my ear:

 

lib

META-INF

emsi.jar

emsi.war

jboss-seam-excel.jar

jboss-seam.jar

 

components.xml

 

 

 

 

    <core:init jndi-pattern="java:global/emsi/emsi.jar/#{ejbName}/local" debug="false"/>
   
    <component class="org.jboss.seam.transaction.EjbSynchronizations" jndi-name="java:app/jboss-seam/EjbSynchronizations"/>
    <component class="org.jboss.seam.async.TimerServiceDispatcher" jndi-name="java:app/jboss-seam/TimerServiceDispatcher"/>
   
    <import>org.jboss.seam.excel.exporter</import>

    <transaction:ejb-transaction/>

    <security:identity authenticate-method="#{authenticator.authenticate}"  />

 

 

 

 

 

faces-config.xml

 

<application>

  <view-handler>org.ajax4jsf.application.AjaxViewHandler</view-handler>

</application>