2 Replies Latest reply on Jan 15, 2010 8:42 AM by crussell42

    EJB3 access via servlet-invoker looses user credentials

    crussell42

      I am using the servlet-invoker.war method of accessing an SLSB via https.

      Works great until my Swing client is idle for more than 60 seconds.

      The next method the client tries to calls on the SLSB returns

       

      Exception:Invalid User

       

      I assume this is happening because of either a http session timeout,

      socket or sslsocket time out.

      As per http://community.jboss.org/message/368816#368816

       

      I have tried changing the InvokerLocator to include ?timeout=300000&invokerDestructionDelay

      Neither seems to help with this situation. Also tried adding this paramater to the RemoteBinding as well

      Nothing seems to help.

       

      What am I missing here. Why and where do I configure this 60 second dumping of the ejb inokers user credentials.

       

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

      The pertinent client code

              securityClient = SecurityClientFactory.getSecurityClient();       
              securityClient.setSimple(username, password)
              securityClient.login();


              Properties props = new Properties();

              props.put("java.naming.factory.initial", "org.jboss.naming.HttpNamingContextFactory");
              props.put("java.naming.provider.url", "https://10.0.0.75:8443/invoker/JNDIFactory");
              props.put("java.naming.factory.url.pkgs", "org.jboss.naming");
              Context jndiContext = new InitialContext(props);

       

       

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

      My SLSB has the following RemoteBinding:

      @RemoteBinding(clientBindUrl = "https://10.0.0.75:8443/servlet-invoker/SSLServerInvokerServlet/?timeout=300000&invokerDestructionDelay=300000")

       

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

      Here is my servlet-invoker-service.xml

      <?xml version="1.0" encoding="UTF-8"?>


      <server>


        <mbean code="org.jboss.remoting.transport.Connector" name="jboss.remoting:service=connector,transport=servlet"
          display-name="Servlet transport Connector">
          <attribute name="InvokerLocator">servlet://${jboss.bind.address}:8080/servlet-invoker/ServerInvokerServlet/?timeout=300000&amp;invokerDestructionDelay=300000</attribute>
          <attribute name="Configuration">
            <handlers>
              <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
            </handlers>
          </attribute>
        </mbean>


        <mbean code="org.jboss.remoting.transport.Connector" name="jboss.remoting:service=connector,transport=sslservlet"
          display-name="Servlet transport Connector">
      <attribute name="InvokerLocator">sslservlet://${jboss.bind.address}:8443/servlet-invoker/SSLServerInvokerServlet/?timeout=300000&amp;invokerDestructionDelay=300000</attribute>

       

          <attribute name="Configuration">

            <handlers>
              <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
            </handlers>
          </attribute>
        </mbean>

      </server>

       

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

      Here is the deploy/servlet-invoker.war/WEB-INF/web.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE web-app PUBLIC
         "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
         "http://java.sun.com/dtd/web-app_2_3.dtd">

      <web-app>

          <servlet>
              <servlet-name>ServerInvokerServlet</servlet-name>
              <description>The ServerInvokerServlet receives requests via HTTP
                 protocol from within a web container and passes it onto the
                 ServletServerInvoker for processing.
              </description>
              <servlet-class>org.jboss.remoting.transport.servlet.web.ServerInvokerServlet</servlet-class>
           
              <init-param>
                  <param-name>locatorUrl</param-name>
                  <param-value>servlet://${jboss.bind.address}:8080/servlet-invoker/ServerInvokerServlet/?timeout=300000&amp;invokerDestructionDelay=300000</param-value>
                  <description>The servlet server invoker</description>
              </init-param>

       


              <load-on-startup>1</load-on-startup>
          </servlet>

       

          <servlet>
              <servlet-name>SSLServerInvokerServlet</servlet-name>
              <description>The ServerInvokerServlet receives requests via HTTPS
                 protocol from within a web container and passes it onto the
                 ServletServerInvoker for processing.
              </description>
              <servlet-class>org.jboss.remoting.transport.servlet.web.ServerInvokerServlet</servlet-class>
           
              <init-param>
                  <param-name>locatorUrl</param-name>
                  <param-value>sslservlet://${jboss.bind.address}:8443/servlet-invoker/SSLServerInvokerServlet/?timeout=300000&amp;invokerDestructionDelay=300000</param-value>
                  <description>The servlet server invoker</description>
              </init-param>

       

              <load-on-startup>2</load-on-startup>
          </servlet>
        
          <servlet-mapping>
              <servlet-name>ServerInvokerServlet</servlet-name>
              <url-pattern>/ServerInvokerServlet/*</url-pattern>
          </servlet-mapping>

       

          <servlet-mapping>
              <servlet-name>SSLServerInvokerServlet</servlet-name>
              <url-pattern>/SSLServerInvokerServlet/*</url-pattern>
          </servlet-mapping>
      </web-app>