0 Replies Latest reply on Sep 2, 2007 6:50 AM by sdf dsfsd

    exception while instantiate Seam component

    sdf dsfsd Newbie

      Hello. When i deploy my easy seam application on jboss AS i got the next exception.

      org.jboss.seam.InstantiationException: Could not instantiate Seam component: authenticator
       at org.jboss.seam.Component.newInstance(Component.java:1708)
       at org.jboss.seam.Component.getInstance(Component.java:1611)
       at org.jboss.seam.Component.getInstance(Component.java:1578)
       at org.jboss.seam.Component.getInstance(Component.java:1572)
       at org.jboss.seam.jsf.SeamELResolver.getValue(SeamELResolver.java:49)
       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
       at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
       at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
       at org.apache.el.parser.AstValue.getTarget(AstValue.java:42)
       at org.apache.el.parser.AstValue.invoke(AstValue.java:127)
       at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
       at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
       at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
       at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
       at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:106)
       at org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:104)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
       at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
       at javax.security.auth.login.LoginContext$5.run(LoginContext.java:706)
       at java.security.AccessController.doPrivileged(Native Method)
       at javax.security.auth.login.LoginContext.invokeCreatorPriv(LoginContext.java:703)
       at javax.security.auth.login.LoginContext.login(LoginContext.java:575)
       at org.jboss.seam.security.Identity.authenticate(Identity.java:249)
       at org.jboss.seam.security.Identity.authenticate(Identity.java:242)
       at org.jboss.seam.security.Identity.login(Identity.java:172)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.el.parser.AstValue.invoke(AstValue.java:131)
       at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
       at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
       at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
       at javax.faces.component.UICommand.broadcast(UICommand.java:383)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:274)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:250)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:405)
       at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.naming.NameNotFoundException: TestH not bound
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
       at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
       at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
       at javax.naming.InitialContext.lookup(InitialContext.java:351)
       at org.jboss.seam.Component.instantiateSessionBean(Component.java:1075)
       at org.jboss.seam.Component.instantiate(Component.java:1061)
       at org.jboss.seam.Component.newInstance(Component.java:1704)
       ... 78 more
      


      I write two next classes for authentification:

      @Stateless
      @Name("authenticator")
      public class AuthenticatorAction implements Authenticator
      {
       @PersistenceContext EntityManager em;
      
       @Out(required=false, scope = SESSION)
       private User user;
      
       public boolean authenticate()
       {
       List results = em.createQuery("select u from User u where u.username=#{identity.username} and u.password=#{identity.password}")
       .getResultList();
      
       if ( results.size()==0 )
       {
       return false;
       }
       else
       {
       user = (User) results.get(0);
       return true;
       }
       }
      
      }
      


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


      ...and next security mapping in components.xml

      <security:identity authenticate-method="#{authenticator.authenticate}"
       security-rules="#{securityRules}"
       remember-me="true"/>