8 Replies Latest reply on Oct 4, 2011 1:15 AM by slawek t

    Problem with incorporation of seam-security (exception: WELD-001304)

    slawek t Novice

      Hi, I have web project based on Seam3 (3.0.0.Final) created by Forge. Everything was OK until I added Seam-Security module (3.0.2.Final). When I use e.g. @LoggedIn annotation or add my own security annotations to seam-faces SomeViewConfig.java enum elements, I receive an error with stacktrace:



      19:58:05,726 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/dms].[FacesServlet]] (http--127.0.0.1-8080-3) Servlet.service() for servlet FacesServlet threw exception: org.jboss.weld.exceptions.IllegalStateException: WELD-001304 More than one context active for scope type javax.enterprise.context.SessionScoped
              at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:661) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:77) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:87) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.seam.security.IdentityImpl$Proxy$_$$_WeldClientProxy.isLoggedIn(IdentityImpl$Proxy$_$$_WeldClientProxy.java) [seam-security-3.0.0.Final.jar:]
              at org.jboss.seam.faces.security.SecurityPhaseListener.enforce(SecurityPhaseListener.java:281) [seam-faces-3.0.2.Final.jar:]
              at org.jboss.seam.faces.security.SecurityPhaseListener.performObservation(SecurityPhaseListener.java:151) [seam-faces-3.0.2.Final.jar:]
              at org.jboss.seam.faces.security.SecurityPhaseListener.observeRenderResponse(SecurityPhaseListener.java:137) [seam-faces-3.0.2.Final.jar:]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.7.0]
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.7.0]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.7.0]
              at java.lang.reflect.Method.invoke(Method.java:601) [:1.7.0]
              at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:635) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:622) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:616) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.seam.faces.event.PhaseEventBridge.handlePhase(PhaseEventBridge.java:95) [seam-faces-3.0.2.Final.jar:]
              at org.jboss.seam.faces.event.PhaseEventBridge.beforePhase(PhaseEventBridge.java:103) [seam-faces-3.0.2.Final.jar:]
              at org.jboss.seam.faces.event.DelegatingPhaseListener.beforePhase(DelegatingPhaseListener.java:43) [seam-faces-3.0.2.Final.jar:]
              at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.jboss.seam.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:62) [seam-servlet-3.0.0.Final.jar:]
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.jboss.seam.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:72) [seam-servlet-3.0.0.Final.jar:]
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118) [prettyfaces-jsf2-3.3.0.jar:]
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
              at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
              at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.0.2.Final.jar:7.0.2.Final]
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
              at java.lang.Thread.run(Thread.java:722) [:1.7.0]


      The project was deployed on Jboss AS7 (7.0.2).


      Is there some obvious mistake I made?
      What could be the cause of that error?

        • 1. Re: Problem with incorporation of seam-security (exception: WELD-001304)
          Jason Porter Master

          What happens on AS 7.0.1? 7.0.2 using Mojarra 2.1.3 which we have yet to verify everything works correctly with Seam Faces.

          • 2. Re: Problem with incorporation of seam-security (exception: WELD-001304)
            slawek t Novice

            The same error on jboss as 7.0.1. This error motivated me to migrate to 7.0.2 and check if the issue still remains - unfortunately remains.

            • 3. Re: Problem with incorporation of seam-security (exception: WELD-001304)
              Jason Porter Master

              That seems very strange that you would have more than one session being created. Could you please post some code?

              • 4. Re: Problem with incorporation of seam-security (exception: WELD-001304)
                slawek t Novice

                I'm not sure what to show. Here are my key files (I think):


                pom.xml



                ...     
                <properties>
                          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                        <errai.version>1.3.0-SNAPSHOT</errai.version>
                          <gwt.version>2.4.0</gwt.version>
                          <weld.version>1.1.2.Final</weld.version>
                          <gwt.maven>2.3.0-1</gwt.maven>
                          <slf4j.version>1.6.2</slf4j.version>
                          <uel.impl.version>2.1.2-b04</uel.impl.version>
                     </properties>
                     <dependencies>
                          <dependency>
                               <groupId>org.jboss.spec</groupId>
                               <artifactId>jboss-javaee-6.0</artifactId>
                               <version>1.0.0.Final</version>
                               <type>pom</type>
                               <scope>provided</scope>
                          </dependency>
                     <dependency>
                          <groupId>org.jboss.seam.persistence</groupId>
                          <artifactId>seam-persistence</artifactId>
                          <version>3.0.0.Final</version>
                     </dependency>
                     <dependency>
                          <groupId>org.hibernate</groupId>
                          <artifactId>hibernate-entitymanager</artifactId>
                          <version>4.0.0.CR3</version>
                          <scope>provided</scope>
                     </dependency>
                          <dependency>
                               <groupId>org.hibernate</groupId>
                               <artifactId>hibernate-validator</artifactId>
                               <version>4.2.0.Final</version>
                               <classifier />
                               <exclusions>
                                    <exclusion>
                                         <groupId>javax.xml.bind</groupId>
                                         <artifactId>jaxb-api</artifactId>
                                    </exclusion>
                                    <exclusion>
                                         <groupId>com.sun.xml.bind</groupId>
                                         <artifactId>jaxb-impl</artifactId>
                                    </exclusion>
                               </exclusions>
                          </dependency>
                          <dependency>
                               <groupId>org.hibernate</groupId>
                               <artifactId>hibernate-core</artifactId>
                               <version>4.0.0.CR3</version>
                               <classifier />
                          </dependency>
                
                          <dependency>
                               <groupId>org.hibernate.javax.persistence</groupId>
                               <artifactId>hibernate-jpa-2.0-api</artifactId>
                               <version>1.0.0.Final</version>
                               <classifier />
                          </dependency>
                
                          <dependency>
                               <groupId>org.jboss.logmanager</groupId>
                               <artifactId>jboss-logmanager</artifactId>
                               <version>[1.1.0,)</version>
                               <scope>provided</scope>
                          </dependency>
                
                          <!-- General dependencies for standard applications -->
                          <dependency>
                               <groupId>junit</groupId>
                               <artifactId>junit</artifactId>
                               <version>4.8.2</version>
                               <scope>test</scope>
                          </dependency>
                          <dependency>
                               <groupId>log4j</groupId>
                               <artifactId>log4j</artifactId>
                               <version>1.2.16</version>
                          </dependency>
                          <dependency>
                               <groupId>org.slf4j</groupId>
                               <artifactId>slf4j-api</artifactId>
                               <version>1.6.2</version>
                               <scope>provided</scope>
                          </dependency>
                          <dependency>
                               <groupId>org.slf4j</groupId>
                               <artifactId>jcl-over-slf4j</artifactId>
                               <version>1.6.2</version>
                               <scope>provided</scope>
                          </dependency>
                          <dependency>
                               <groupId>org.slf4j</groupId>
                               <artifactId>slf4j-log4j12</artifactId>
                               <version>1.6.2</version>
                               <scope>provided</scope>
                          </dependency>
                          <dependency>
                               <groupId>javax.servlet</groupId>
                               <artifactId>servlet-api</artifactId>
                               <version>2.5</version>
                               <scope>provided</scope>
                          </dependency>
                          <dependency>
                               <groupId>javax.annotation</groupId>
                               <artifactId>jsr250-api</artifactId>
                               <version>1.0</version>
                               <scope>provided</scope>
                          </dependency>
                          <dependency>
                               <groupId>net.sf.flexjson</groupId>
                               <artifactId>flexjson</artifactId>
                               <version>2.1</version>
                          </dependency>
                
                          <dependency>
                               <groupId>mysql</groupId>
                               <artifactId>mysql-connector-java</artifactId>
                               <version>5.1.17</version>
                               <scope>provided</scope>
                               <classifier />
                          </dependency>
                          <dependency>
                               <groupId>javax.validation</groupId>
                               <artifactId>validation-api</artifactId>
                               <version>1.0.0.GA</version>
                               <classifier />
                          </dependency>
                          <dependency>
                               <groupId>javax.transaction</groupId>
                               <artifactId>jta</artifactId>
                               <version>1.1</version>
                               <classifier />
                          </dependency>
                          <dependency>
                               <groupId>javax.el</groupId>
                               <artifactId>el-api</artifactId>
                               <version>1.0</version>
                               <scope>provided</scope>
                               <classifier />
                          </dependency>
                          <dependency>
                               <groupId>joda-time</groupId>
                               <artifactId>joda-time</artifactId>
                               <version>1.6</version>
                          </dependency>
                          <dependency>
                               <groupId>com.google.gwt</groupId>
                               <artifactId>gwt-servlet</artifactId>
                               <version>${gwt.version}</version>
                               <classifier />
                          </dependency>
                          <dependency>
                               <groupId>com.google.gwt</groupId>
                               <artifactId>gwt-user</artifactId>
                               <version>${gwt.version}</version>
                               <scope>provided</scope>
                               <classifier />
                          </dependency>
                          <dependency>
                               <groupId>org.json</groupId>
                               <artifactId>json</artifactId>
                               <version>20090211</version>
                               <classifier />
                          </dependency>
                          <dependency>
                               <groupId>com.googlecode.gwt.inject</groupId>
                               <artifactId>gin</artifactId>
                               <version>1.5</version>
                               <classifier />
                          </dependency>
                          <dependency>
                               <groupId>javax.validation</groupId>
                               <artifactId>validation-api</artifactId>
                               <version>1.0.0.GA</version>
                               <classifier>sources</classifier>
                          </dependency>
                          <dependency>
                               <groupId>xalan</groupId>
                               <artifactId>xalan</artifactId>
                               <version>2.7.1</version>
                               <classifier />
                          </dependency>
                
                          <dependency>
                              <groupId>commons-logging</groupId>
                              <artifactId>commons-logging</artifactId>
                              <version>1.1.1</version>
                          </dependency>
                
                          <dependency>
                               <groupId>javax.jcr</groupId>
                               <artifactId>jcr</artifactId>
                               <version>2.0</version>
                          </dependency>
                          <!-- Jackrabbit content repository -->
                          <dependency>
                               <groupId>org.apache.jackrabbit</groupId>
                               <artifactId>jackrabbit-core</artifactId>
                               <version>2.2.7</version>
                          </dependency>
                          <dependency>
                               <groupId>org.apache.jackrabbit</groupId>
                               <artifactId>jackrabbit-jca</artifactId>
                               <version>2.2.7</version>
                          </dependency>
                          <dependency>
                               <groupId>org.mockito</groupId>
                               <artifactId>mockito-all</artifactId>
                               <version>1.8.5</version>
                               <scope>test</scope>
                          </dependency>
                
                     <dependency>
                          <groupId>javax.enterprise</groupId>
                          <artifactId>cdi-api</artifactId>
                          <scope>provided</scope>
                          <version>1.0-SP4</version>
                     </dependency>
                
                     <!-- errai -->
                     <dependency>
                          <groupId>org.jboss.errai</groupId>
                          <artifactId>errai-bus</artifactId>
                          <exclusions>
                               <exclusion>
                                    <groupId>junit</groupId>
                                    <artifactId>junit</artifactId>
                               </exclusion>
                               <exclusion>
                                    <artifactId>javax.inject</artifactId>
                                    <groupId>javax.inject</groupId>
                               </exclusion>
                          </exclusions>
                          <version>${errai.version}</version>
                     </dependency>
                     
                     <dependency>
                          <groupId>org.jboss.errai</groupId>
                          <artifactId>errai-ioc</artifactId>
                          <exclusions>
                               <exclusion>
                                    <artifactId>jsr250-api</artifactId>
                                    <groupId>javax.annotation</groupId>
                               </exclusion>
                               <exclusion>
                                    <artifactId>javax.inject</artifactId>
                                    <groupId>javax.inject</groupId>
                               </exclusion>
                          </exclusions>
                          <scope>provided</scope>
                          <version>${errai.version}</version>
                     </dependency>
                
                     <dependency>
                          <groupId>org.jboss.errai</groupId>
                          <artifactId>errai-tools</artifactId>
                          <!-- <scope>provided</scope> -->
                          <version>${errai.version}</version>
                     </dependency>
                
                     <dependency>
                          <groupId>org.jboss.errai</groupId>
                          <artifactId>errai-javax-enterprise</artifactId>
                          <version>${errai.version}</version>
                          <scope>provided</scope>
                     </dependency>
                
                     <dependency>
                          <groupId>org.jboss.errai</groupId>
                          <artifactId>errai-weld-integration</artifactId>
                          <version>${errai.version}</version>
                     </dependency>
                
                     <!-- Weld is installed within JBoss -->
                     <dependency>
                          <groupId>org.glassfish.web</groupId>
                          <artifactId>el-impl</artifactId>
                          <version>${uel.impl.version}</version>
                          <scope>provided</scope>
                     </dependency>
                
                     <dependency>
                          <groupId>org.jboss.weld.servlet</groupId>
                          <artifactId>weld-servlet</artifactId>
                          <scope>provided</scope>
                          <version>${weld.version}</version>
                     </dependency>
                
                     <dependency>
                          <groupId>org.jboss.weld</groupId>
                          <artifactId>weld-core</artifactId>
                          <scope>provided</scope>
                          <version>${weld.version}</version>
                     </dependency>
                
                     <dependency>
                          <groupId>org.jboss.weld.se</groupId>
                          <artifactId>weld-se-core</artifactId>
                          <scope>provided</scope>
                          <version>${weld.version}</version>
                     </dependency>
                
                     <dependency>
                          <groupId>org.jboss.weld</groupId>
                          <artifactId>weld-spi</artifactId>
                          <scope>provided</scope>
                          <version>1.1.Final</version>
                     </dependency>
                
                     <!-- AS7 Service Activator -->
                     <dependency>
                          <groupId>org.jboss.errai</groupId>
                          <artifactId>jboss7-support</artifactId>
                          <version>${errai.version}</version>
                     </dependency>
                
                     <dependency>
                        <groupId>org.jboss.seam.security</groupId>
                        <artifactId>seam-security</artifactId>
                        <version>3.0.0.Final</version>
                    </dependency>
                
                </dependencies>
                ...
                




                web.xml


                <?xml version="1.0" encoding="UTF-8"?>
                <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
                     <display-name>dms</display-name>
                
                     <servlet>
                          <servlet-name>ErraiServlet</servlet-name>
                          <servlet-class>org.jboss.errai.bus.server.servlet.DefaultBlockingServlet</servlet-class>
                          <init-param>
                               <param-name>service-locator</param-name>
                               <param-value>org.jboss.errai.cdi.server.CDIServiceLocator</param-value>
                          </init-param>
                
                          <load-on-startup>1</load-on-startup>
                     </servlet>
                
                     <servlet-mapping>
                          <servlet-name>ErraiServlet</servlet-name>
                          <url-pattern>*.erraiBus</url-pattern>
                     </servlet-mapping>
                
                     <context-param>
                          <param-name>errai.properties</param-name>
                          <param-value>/WEB-INF/errai.properties</param-value>
                     </context-param>
                
                     <context-param>
                          <param-name>login.config</param-name>
                          <param-value>/WEB-INF/login.config</param-value>
                     </context-param>
                
                     <context-param>
                          <param-name>users.properties</param-name>
                          <param-value>/WEB-INF/users.properties</param-value>
                     </context-param>
                
                     <session-config>
                          <session-timeout>30</session-timeout>
                     </session-config>
                     <welcome-file-list>
                          <welcome-file>/index.xhtml</welcome-file>
                     </welcome-file-list>
                     <error-page>
                          <error-code>404</error-code>
                          <location>/404.html</location>
                     </error-page>
                     <error-page>
                          <error-code>500</error-code>
                          <location>/500.html</location>
                     </error-page>
                     
                      <mime-mapping>
                        <extension>ico</extension>
                        <mime-type>image/ico</mime-type>
                    </mime-mapping>
                     
                </web-app>
                




                beans.xml


                <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xmlns:s="urn:java:ee" xmlns:security="urn:java:org.jboss.seam.security"
                     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd">
                
                     <interceptors>
                          <class>org.jboss.seam.security.extension.SecurityInterceptor</class>
                     </interceptors>
                
                </beans>



                And finally my so small of code which causes the error:


                package test.server.action;
                
                import javax.inject.Inject;
                import javax.inject.Named;
                import org.jboss.seam.security.annotations.LoggedIn;
                import org.jboss.seam.transaction.TransactionPropagation;
                import org.jboss.seam.transaction.Transactional;
                import test.server.service.UserService;
                
                @Named
                @Transactional( TransactionPropagation.SUPPORTS )
                public class TestAction {
                
                    @Inject
                    private Numbers numbers;
                
                    @Inject
                    private UserService userService;
                
                     
                    @LoggedIn   // <= if it exists, it causes the error
                    public String getText( ) {
                        return userService.getAllUsers( true ).toString( );
                    }
                
                }
                



                It looks like any activation of security module leads to error:


                10:46:13,917 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) Error Rendering View[/index.xhtml]: javax.el.ELException: /index.xhtml: org.jboss.weld.exceptions.IllegalStateException: WELD-001304 More than one context active for scope type javax.enterprise.context.SessionScoped
                     at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:88) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
                     at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
                     at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
                     at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
                     at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
                     at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
                     at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
                     at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
                     at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
                     at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
                     at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
                     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
                     at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
                     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
                     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
                     at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
                     at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
                     at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.0.2.Final.jar:7.0.2.Final]
                     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
                     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
                     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
                     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
                     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
                     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
                     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
                     at java.lang.Thread.run(Thread.java:722) [:1.7.0]



                The same situation is when I remove @LoggedIn annotation (from code attached above) and use my own security annotation.


                • 5. Re: Problem with incorporation of seam-security (exception: WELD-001304)
                  Jason Porter Master

                  Okay, first try using a new version of Seam Security. If that's still a problem I'd ask the Errai guys, it kind of looks like it might be an AJAX issue where a call is being made before the first request completes so you're getting two sessions started

                  • 6. Re: Problem with incorporation of seam-security (exception: WELD-001304)
                    slawek t Novice

                    Okay, first try using a new version of Seam Security.


                    Unfortunately, using seam-security version 3.1.0.Beta2 causes error during application deployment like this:


                    21:28:21,658 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-15) MSC00001: Failed to start service jboss.deployment.unit."dms.war".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."dms.war".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Identity] with qualifiers [@Default] at injection point [[field] @Inject org.jboss.seam.security.management.action.ChangePasswordAction.identity]
                         at org.jboss.as.weld.services.WeldService.start(WeldService.java:96)
                         at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
                         at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
                         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [:1.7.0]
                         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [:1.7.0]
                         at java.lang.Thread.run(Thread.java:722) [:1.7.0]
                    Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Identity] with qualifiers [@Default] at injection point [[field] @Inject org.jboss.seam.security.management.action.ChangePasswordAction.identity]
                         at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:270)
                         at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:106)
                         at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:129)
                         at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:351)
                         at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:336)
                         at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:404)
                         at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82)
                         at org.jboss.as.weld.services.WeldService.start(WeldService.java:89)
                         ... 5 more
                    






                    If that's still a problem I'd ask the Errai guys, it kind of looks like it might be an AJAX issue where a call is being made before the first request completes so you're getting two sessions started


                    I don't think that Errai is involved into the issue because I'm not using GWT (with ErraiBus) to call server-side services. The exception raises when I request jsf page (default index.xhtml generated by Forge and I only added one entry to that: #{testAction.text} to call my annotated with @LoggedIn action's method).

                    • 7. Re: Problem with incorporation of seam-security (exception: WELD-001304)
                      Shane Bryzak Master

                      Are you including the Seam Security implementation JAR in your project?  (i.e. seam-security.jar)

                      • 8. Re: Problem with incorporation of seam-security (exception: WELD-001304)
                        slawek t Novice

                        Shane Bryzak wrote on Oct 03, 2011 18:15:


                        Are you including the Seam Security implementation JAR in your project?  (i.e. seam-security.jar)


                        In deployed project (lib/ folder) there are two jars: seam-security-api-3.1.0.Beta2.jar and seam-security-3.1.0.Beta2.jar