0 Replies Latest reply on Jul 1, 2013 6:40 PM by Fabian Riako

    Could not instantiate Seam component: org.jboss.seam.web.session

    Fabian Riako Newbie

      All,

       

       

      @Scope(ScopeType.EVENT) 
      public class AccessControl {
      
      @Observer("org.jboss.seam.security.loginSuccessful") 
      public void initializeUserModules(){
              Set<String> modules = new HashSet<String>(aclService.loadPermission(identity.getDomainUserBean().getUserId(), Constants.APPLICATION_NAME));
              if(modules!=null && modules.size()>0){
                  Context sessionContext  = Contexts.getSessionContext();
                  if(sessionContext!=null){
                      sessionContext.set("modules", modules);
                  }
              }        
          }
      
      public boolean hasPermission(String module) {
              try {
                  Context sessionContext  = Contexts.getSessionContext();
                  if(sessionContext!=null){                
                      Object modulesMap = sessionContext.get("modules");
                      if(modulesMap!=null){
                          Set<String> modules = new HashSet<String>((Collection<? extends String>) modulesMap);
                          return modules.contains(module);
                      }
                      return false;
                  }
                  return false;
              } catch (Exception e) {                       
                  return false;
              }
          }
      
      }
      

       

      After I added the above methods to AccessControl class I am getting the below error. Can somebody say the reason for it. Do I need to remove the HashMap from session on logout. I am using jdk 7 and EAP 6.

       

      2013-07-01 17:26:59,014 ERROR [org.jboss.as.txn] JBAS010152: APPLICATION ERROR: transaction still active in request with status 0

      2013-07-01 17:26:59,188 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/workschain].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.web.session

          at org.jboss.seam.Component.newInstance(Component.java:2170)

          at org.jboss.seam.Component.getInstance(Component.java:2024)

          at org.jboss.seam.Component.getInstance(Component.java:2003)

          at org.jboss.seam.Component.getInstance(Component.java:1997)

          at org.jboss.seam.Component.getInstance(Component.java:1970)

          at org.jboss.seam.web.Session.getInstance(Session.java:122)

          at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.java:406)

          at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:164)

          at org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:89)

          at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:70)

          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

          at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)

          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

          at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)

          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

          at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

          at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.event(JBossWebContext.java:67)

          at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.invoke(JBossWebContext.java:48)

          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397)

          at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)

          at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

          at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:490)

          at org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:487)

          at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2039)

          at java.lang.Thread.run(Thread.java:722)

      Caused by: java.lang.NullPointerException

          at com.sun.faces.context.SessionMap.put(SessionMap.java:127)

          at com.sun.faces.context.SessionMap.put(SessionMap.java:61)

          at org.jboss.seam.contexts.BasicContext.set(BasicContext.java:84)

          at org.jboss.seam.Component.newInstance(Component.java:2152)

          ... 32 more

       

      Thanks