1 Reply Latest reply on Feb 25, 2013 3:13 AM by shenlanemo

    seam-remoting call identity.logout occur {inject an HttpSession} error

    shenlanemo

      i use seam-remoting call identity.login and identity.logout.

       

      call identity.login run correct,but call identity.logout run to a error.

       

      my  Authenticator Class below.

      -------------------------------------------------------

      public class SimpleAuthenticator extends BaseAuthenticator implements Authenticator {

       

         @Inject Credentials credentials;

        

         @Override

       

         public void authenticate() {

       

            if ("demo".equals(credentials.getUsername()) &&

       

                  credentials.getCredential() instanceof PasswordCredential &&

       

                  "demo".equals(((PasswordCredential) credentials.getCredential()).getValue()))  {

       

               setStatus(AuthenticationStatus.SUCCESS);

       

               setUser(new SimpleUser("demo"));

              

               System.out.println("SUCCESS.");

            }else{

                setStatus(AuthenticationStatus.FAILURE);

               

                System.out.println("FAILURE.");

            }

       

         }

       

      }

      -----------------------------------------------------

       

       

      and this is a Login action below.

      -------------------------------------------------------

      public class Login {

          @Inject Credentials credentials;

          @Inject Identity identiy;

         

          @WebRemote public void check_user(String user_name,String user_password) throws Exception {

             

              credentials.setCredential(new PasswordCredential(user_password));

              credentials.setUsername(user_name);

              identiy.login();

          }

          @WebRemote public void logout() throws Exception {

              identiy.logout();

          }   

      }

      ------------------------------------------------------

       

       

       

      in the browser,i use javascript to call check_user function:

      ------------------------------------------------------

      Seam.createBean("Login", "Formal").check_user("demo","demo");

      -----------------------------------------------------

      then console out put 'SUCCESS'.

      but when i called Seam.createBean("Login", "Formal").logout(callback);

      the browser said :

      ==============

      An exception has occurred while executing a remote request: java.lang.IllegalStateException:Attempted to inject an HttpSession before it has been initialized.

      ==============

      the console show :

      18:28:04,121 ERROR [org.jboss.seam.remoting.ExecutionHandler] (http-localhost-127.0.0.1-8080-4) Error while executing call: java.lang.IllegalStateException: Attempted to inject an HttpSession before it has been initialized.

          at org.jboss.solder.servlet.http.ImplicitHttpServletObjectsProducer.getHttpSession(ImplicitHttpServletObjectsProducer.java:55) [solder-impl-3.1.0.Final.jar:3.1.0.Final]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_07]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_07]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_07]

          at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_07]

          at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

          at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

          at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

          at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

          at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

          at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstance(MethodInjectionPoint.java:137) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

          at org.jboss.weld.bean.ProducerMethod$1.produce(ProducerMethod.java:133) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

          at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:299) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

          at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:107) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

          at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

          at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:104) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

          at org.jboss.weld.proxies.HttpSession$1681475766$Proxy$_$$_WeldClientProxy.invalidate(HttpSession$1681475766$Proxy$_$$_WeldClientProxy.java) [weld-core-1.1.5.AS71.Final.jar:]

          at org.jboss.seam.security.IdentityImpl.logout(IdentityImpl.java:427) [seam-security-3.1.0.Final.jar:3.1.0.Final]

          at org.jboss.seam.security.IdentityImpl$Proxy$_$$_WeldClientProxy.logout(IdentityImpl$Proxy$_$$_WeldClientProxy.java) [seam-security-3.1.0.Final.jar:3.1.0.Final]

          at Login.logout(Login.java:21)    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_07]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_07]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_07]

          at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_07]

          at org.jboss.seam.remoting.Call.execute(Call.java:170) [seam-remoting-3.1.0.Final.jar:3.1.0.Final]

          at org.jboss.seam.remoting.ExecutionHandler.handle(ExecutionHandler.java:72) [seam-remoting-3.1.0.Final.jar:3.1.0.Final]

          at org.jboss.seam.remoting.Remoting.service(Remoting.java:251) [seam-remoting-3.1.0.Final.jar:3.1.0.Final]

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.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.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

          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:722) [rt.jar:1.7.0_07]

       

          

       

       

      i guess  the seam-remoting may be not support seam-security completely.

       

      i want jsp not jsf.some one can help me ?

       

      thanks very much.