Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Detect timeout
Detect timeout [message #1071494] Sat, 20 July 2013 08:35 Go to next message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 330
Registered: August 2011
Senior Member
Hi,

At the server side, in tomcat, a time out is set: <session-timeout>30</session-timeout>). When there is no user activity for more then 30 minutes from a swing client and the user restarts his activity, all kinds of processing errors occur because the session is not there anymore.

How can I handle this situation in a way that I give a proper error message so the user knows that he has to log-on again.

Regards Bertin
Re: Detect timeout [message #1072184 is a reply to message #1071494] Mon, 22 July 2013 08:52 Go to previous messageGo to next message
Eclipse UserFriend
Hi Bertin,

I tried to reproduce the timeout issue without success. Could you please give more details about the behavior? Security Filter type, Exception stack trace, web.xml configuration.
Thank you.

-andreas
Re: Detect timeout [message #1072292 is a reply to message #1072184] Mon, 22 July 2013 13:22 Go to previous messageGo to next message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 330
Registered: August 2011
Senior Member
Thanks Andreas,

its the first time that I ran into this behaviour so I do not know what to expect. Should it behave differently? Should I get some nice error or warning?

It will take me some time to gather the info because i'm hardly in the office. I will let you know.


Regards Bertin
Re: Detect timeout [message #1072353 is a reply to message #1072292] Mon, 22 July 2013 15:23 Go to previous messageGo to next message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 330
Registered: August 2011
Senior Member
Hi,

I have some more info on the timeout problem

Regards Bertin

In the GUI the user only sees a dialog with Processing Error.

In the .log file on the client:

!ENTRY org.eclipse.scout.rt.client 4 0 2013-07-22 17:09:06.445
!MESSAGE org.eclipse.scout.rt.client.services.common.exceptionhandler.internal.InternalClientExceptionHandlerService.differentiatedLog(InternalClientExceptionHandlerService.java:116) ProcessingException: ProcessingStatus[ERROR code=0 Calling IMedewerkerOutlineService.getDossiersPerClient() / Processing error]
!STACK 0
ProcessingException[ProcessingStatus[ERROR code=0 Calling IMedewerkerOutlineService.getDossiersPerClient() / Processing error]]
	at org.eclipse.scout.rt.client.servicetunnel.AbstractServiceTunnel.invokeService(AbstractServiceTunnel.java:167)
	at org.eclipse.scout.rt.client.servicetunnel.http.internal.InternalHttpServiceTunnel.invokeService(InternalHttpServiceTunnel.java:174)
	at org.eclipse.scout.rt.client.servicetunnel.http.HttpServiceTunnel.invokeService(HttpServiceTunnel.java:115)
	at org.eclipse.scout.rt.client.servicetunnel.ServiceTunnelInvocationHandler.invoke(ServiceTunnelInvocationHandler.java:47)
	at $Proxy12.getDossiersPerClient(Unknown Source)
	at nl.rid.connect.client.ui.desktop.outlines.pages.DossiersTablePage.execLoadTableData(DossiersTablePage.java:39)
	at org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithTable.execPopulateTable(AbstractPageWithTable.java:242)
	at org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithTable.loadTableDataImpl(AbstractPageWithTable.java:633)
	at org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithTable.loadChildren(AbstractPageWithTable.java:696)
	at org.eclipse.scout.rt.client.ui.basic.tree.AbstractTreeNode.ensureChildrenLoaded(AbstractTreeNode.java:907)
	at org.eclipse.scout.rt.client.ui.desktop.outline.DefaultPageChangeStrategy.pageChanged(DefaultPageChangeStrategy.java:43)
	at org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline.handleActivePageChanged(AbstractOutline.java:429)
	at org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline.access$0(AbstractOutline.java:422)
	at org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline$P_OutlineListener.treeChanged(AbstractOutline.java:465)
	at org.eclipse.scout.rt.client.ui.basic.tree.TreeAdapter.treeChangedBatch(TreeAdapter.java:22)
	at org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree.fireTreeEventBatchInternal(AbstractTree.java:2172)
	at org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree.processChangeBuffer(AbstractTree.java:2259)
	at org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree.setTreeChanging(AbstractTree.java:843)
	at org.eclipse.scout.rt.client.ui.basic.tree.AbstractTree$P_UIFacade.setNodesSelectedFromUI(AbstractTree.java:2541)
	at org.eclipse.scout.rt.ui.swing.basic.tree.SwingScoutTree$6.run(SwingScoutTree.java:408)
	at org.eclipse.scout.rt.ui.swing.concurrency.SwingScoutSynchronizer$1.runVoid(SwingScoutSynchronizer.java:66)
	at org.eclipse.scout.rt.client.ClientJob.runStatus(ClientJob.java:177)
	at org.eclipse.scout.rt.client.ClientJob.runTransactionWrapper(ClientJob.java:161)
	at org.eclipse.scout.rt.client.ClientJob.run(ClientJob.java:149)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)


In the log file on the server

!ENTRY org.eclipse.scout.rt.shared 4 0 2013-07-22 17:09:06.402
!MESSAGE org.eclipse.scout.rt.shared.services.common.exceptionhandler.LogExceptionHandlerService.differentiatedLog(LogExceptionHandlerService.java:76) ProcessingStatus[ERROR code=0 invoking nl.rid.connect.shared.services.outline.IMedewerkerOutlineService:getDossiersPerClient / No sqlService found for vestiging null]
!STACK 0
ProcessingException[ProcessingStatus[ERROR code=0 invoking nl.rid.connect.shared.services.outline.IMedewerkerOutlineService:getDossiersPerClient / No sqlService found for vestiging null]]
	at nl.rid.connect.server.services.common.sql.MpxSqlServiceProvider.getSqlServiceClass(MpxSqlServiceProvider.java:72)
	at nl.rid.connect.server.services.outline.MedewerkerOutlineService.getDossiersPerClient(MedewerkerOutlineService.java:135)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.eclipse.scout.service.ServiceUtility.invoke(ServiceUtility.java:172)
	at org.eclipse.scout.rt.server.DefaultTransactionDelegate.invokeImpl(DefaultTransactionDelegate.java:218)
	at org.eclipse.scout.rt.server.DefaultTransactionDelegate.invoke(DefaultTransactionDelegate.java:92)
	at org.eclipse.scout.rt.server.ServiceTunnelServlet.runServerJobTransactionWithDelegate(ServiceTunnelServlet.java:391)
	at org.eclipse.scout.rt.server.ServiceTunnelServlet.runServerJobTransaction(ServiceTunnelServlet.java:387)
	at org.eclipse.scout.rt.server.ServiceTunnelServlet$RemoteServiceJob.runTransaction(ServiceTunnelServlet.java:415)
	at org.eclipse.scout.rt.server.ServerJob.runTransactionWrapper(ServerJob.java:202)
	at org.eclipse.scout.rt.server.ServerJob.access$0(ServerJob.java:190)
	at org.eclipse.scout.rt.server.ServerJob$1.run(ServerJob.java:161)
	at org.eclipse.scout.rt.server.ServerJob$1.run(ServerJob.java:1)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:415)
	at org.eclipse.scout.rt.server.ServerJob.run(ServerJob.java:156)
	at org.eclipse.scout.commons.job.JobEx.runNow(JobEx.java:50)
	at org.eclipse.scout.rt.server.ServerJob.runNow(ServerJob.java:148)
	at org.eclipse.scout.rt.server.ServiceTunnelServlet.doPost(ServiceTunnelServlet.java:296)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.eclipse.scout.http.servletfilter.HttpServletEx.access$0(HttpServletEx.java:1)
	at org.eclipse.scout.http.servletfilter.HttpServletEx$1.service(HttpServletEx.java:38)
	at org.eclipse.scout.http.servletfilter.internal.FilterChainImpl.doFilter(FilterChainImpl.java:44)
	at org.eclipse.scout.http.servletfilter.helper.HttpAuthJaasFilter.doFilter(HttpAuthJaasFilter.java:62)
	at org.eclipse.scout.http.servletfilter.internal.FilterChainImpl.doFilter(FilterChainImpl.java:41)
	at org.eclipse.scout.http.servletfilter.helper.DevelopmentAuthFilter.doFilter(DevelopmentAuthFilter.java:61)
	at org.eclipse.scout.http.servletfilter.internal.FilterChainImpl.doFilter(FilterChainImpl.java:41)
	at org.eclipse.scout.http.servletfilter.security.AbstractChainableSecurityFilter.doFilter(AbstractChainableSecurityFilter.java:103)
	at org.eclipse.scout.http.servletfilter.internal.FilterChainImpl.doFilter(FilterChainImpl.java:41)
	at org.eclipse.scout.http.servletfilter.security.AbstractChainableSecurityFilter.doFilter(AbstractChainableSecurityFilter.java:103)
	at org.eclipse.scout.http.servletfilter.internal.FilterChainImpl.doFilter(FilterChainImpl.java:41)
	at org.eclipse.scout.http.servletfilter.security.AbstractChainableSecurityFilter.doFilterInternal(AbstractChainableSecurityFilter.java:220)
	at org.eclipse.scout.http.servletfilter.security.AbstractChainableSecurityFilter.access$0(AbstractChainableSecurityFilter.java:219)
	at org.eclipse.scout.http.servletfilter.security.AbstractChainableSecurityFilter$1.run(AbstractChainableSecurityFilter.java:157)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:415)
	at org.eclipse.scout.http.servletfilter.security.AbstractChainableSecurityFilter.doFilter(AbstractChainableSecurityFilter.java:149)
	at org.eclipse.scout.http.servletfilter.internal.FilterChainImpl.doFilter(FilterChainImpl.java:41)
	at org.eclipse.scout.http.servletfilter.ServletFilterDelegate.delegateServiceMethod(ServletFilterDelegate.java:57)
	at org.eclipse.scout.http.servletfilter.HttpServletEx.service(HttpServletEx.java:35)
	at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
	at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.eclipse.equinox.servletbridge.BridgeServlet.service(BridgeServlet.java:115)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)

Re: Detect timeout [message #1072447 is a reply to message #1072353] Mon, 22 July 2013 19:37 Go to previous messageGo to next message
Eclipse UserFriend
The server stacktrace says there is an issue on MpxSqlServiceProvider.java:72. Since this class is a project class I'm not able to analyze more precisely. Is the MpxSqlServiceProvider stateless?

The expected behavior should be not even a warning/error message box. Either a login box should show up again or the system should work without any troubles.

In case of using a derby DB there is allowed only one jdbc connection at the time. So if you restarted the server within between the connection to the database could probably not be established.

Furthermore I would be interested in the security filter you are using. I'm trying to rebuild kind of similar setup.

-andreas
Re: Detect timeout [message #1072916 is a reply to message #1072353] Tue, 23 July 2013 19:16 Go to previous messageGo to next message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 330
Registered: August 2011
Senior Member
Hi Andreas,

below the code that thows the exception and the security filter.

The code that throws the exception executes ServerSession.get().getMpxDatabaseNummer(); and/or ServerSession.get().getMpxVestigingNaam(); at least one of these methods must return a valid value, but in the case the time-out is expired, it does not return anything.

Regards Bertin



/**
 * 
 */
public class MpxSqlServiceProvider {
  // db1
  private static final String RID_1 = "RID 1";
  private static final String RID_2 = "RID 2";
  private static final String RID_3 = "RID 3";
  // db2
  private static final String RID_4 = "RID 4";
  private static final String RID_5 = "RID 5";
  private static final String RID_6 = "RID 6";
  private static final String RID_7 = "RID 7";
  // db3
  private static final String RID_8 = "RID 8";
  private static final String RID_9 = "RID 9";
  private static final String RID_10 = "RID 10";
  // db4
  private static final String RID_11 = "RID 11";
  private static final String RID_12 = "RID 12";
  private static final String RID_13 = "RID 13";

  public static Class<? extends AbstractSqlService> getSqlServiceClass() throws ProcessingException {

    int databaseNummer = ServerSession.get().getMpxDatabaseNummer();
    //System.out.println("Database nummer = " + databaseNummer);

    switch (databaseNummer) {
      case 1:
        return Mpx1SqlService.class;
      case 2:
        return Mpx2SqlService.class;
      case 3:
        return Mpx3SqlService.class;
      case 4:
        return Mpx4SqlService.class;
      default: {
        //System.out.println("Database nummer not valid, find by vestigingName");

        String vestigingName = ServerSession.get().getMpxVestigingNaam();

        if (RID_1.equals(vestigingName) || RID_2.equals(vestigingName) || RID_3.equals(vestigingName)) {
          return Mpx1SqlService.class;
        }
        else if (RID_4.equals(vestigingName) || RID_5.equals(vestigingName) || RID_6.equals(vestigingName) || RID_7.equals(vestigingName)) {
          return Mpx2SqlService.class;
        }
        else if (RID_8.equals(vestigingName) || RID_9.equals(vestigingName) || RID_10.equals(vestigingName)) {
          return Mpx3SqlService.class;
        }
        else if (RID_11.equals(vestigingName) || RID_12.equals(vestigingName) || RID_13.equals(vestigingName)) {
          return Mpx4SqlService.class;
        }
        else {
          throw new ProcessingException("No sqlService found for vestiging " + vestigingName); // this is line 72
        }
      }
    }
  }
}




and here the security filter we use:

public class SaltedDataSourceSecurityFilter extends AbstractChainableSecurityFilter {

  private static final IScoutLogger LOG = ScoutLogManager.getLogger(SaltedDataSourceSecurityFilter.class);
  public static final String PROP_BASIC_ATTEMPT = "SaltedDataSourceSecurityFilter.basicAttempt";

  private String m_jdbcUserName;
  private String m_jdbcPassword;

  private String m_jdbcDriverName;
  private String m_jdbcMappingName;
  private String m_selectStatement;
  private String m_selectSaltStatement = "select salt from account where name = ?";

  private boolean m_useJndiConnection = false;
  private String m_jndiName;
  private String m_jndiInitialContextFactory;
  private String m_jndiProviderUrl;
  private String m_jndiUrlPkgPrefixes;

  @Override
  public void init(FilterConfig config0) throws ServletException {
    super.init(config0);
    FilterConfigInjection.FilterConfig config = new FilterConfigInjection(config0, getClass()).getAnyConfig();

    String useJndiConnectionString = config.getInitParameter("useJndiConnection");
    m_useJndiConnection = Boolean.parseBoolean(useJndiConnectionString);

    m_jdbcDriverName = getInitParam(config, "jdbcDriverName");
    m_jdbcMappingName = getInitParam(config, "jdbcMappingName");
    m_jdbcUserName = getInitParam(config, "jdbcUsername");
    m_jdbcPassword = getInitParam(config, "jdbcPassword");
    m_selectStatement = getInitParam(config, "selectUserPass");
    m_jndiName = getInitParam(config, "jndiName");
    m_jndiInitialContextFactory = config.getInitParameter("jndiInitialContextFactory");
    m_jndiProviderUrl = config.getInitParameter("jndiProviderUrl");
    m_jndiUrlPkgPrefixes = config.getInitParameter("jndiUrlPkgPrefixes");
  }

  private String getInitParam(FilterConfig filterConfig, String paramName) throws ServletException {
    String paramValue = filterConfig.getInitParameter(paramName);
    if ((m_useJndiConnection && paramName.indexOf("jndi") != -1 && paramValue == null) || (!m_useJndiConnection && paramName.indexOf("jdbc") != -1 && paramValue == null)) {
      throw new ServletException("Missing init-param with name '" + paramName + "'.");
    }
    return paramValue;
  }

  protected boolean isValidUser(String username, String password) throws ServletException {
    Connection databaseConnection = null;
    PreparedStatement stmt = null;
    try {

      if (m_useJndiConnection) {
        databaseConnection = createJndiConnection();
      }
      else {
        databaseConnection = createJdbcDirectConnection();
      }

      stmt = databaseConnection.prepareStatement(m_selectStatement);
      stmt.setString(1, username);
      stmt.setString(2, password);
      stmt.execute();
      ResultSet resultSet = stmt.getResultSet();
      return (resultSet.next() && resultSet.getString(1).equals(username));
    }
    catch (Exception e) {
      //LOG.error("Cannot SELECT user/pass.", e);
      throw new ServletException(e.getMessage(), e);
    }
    finally {
      try {
        if (stmt != null) {
          stmt.close();
          stmt = null;
        }
      }
      catch (SQLException e) {
        //LOG.warn("Exception in close stmt!", e);
      }
      try {
        if (databaseConnection != null) {
          databaseConnection.close();
          databaseConnection = null;
        }
      }
      catch (SQLException e) {
        //LOG.warn("Exception in close connection!", e);
      }
    }
  }

  @Override
  protected int negotiate(HttpServletRequest req, HttpServletResponse resp, PrincipalHolder holder) throws IOException, ServletException {
    String h = req.getHeader("Authorization");
    if (h != null && h.matches("Basic .*")) {
      String[] a = new String(Base64Utility.decode(h.substring(6)), "ISO-8859-1").split(":", 2);
      String user = a[0].toLowerCase();
      String pass = a[1];
      if (user != null && pass != null) {
        String salt = getSalt(user);
        String passEncrypted = encryptPass(pass + salt);
        if (isValidUser(user, passEncrypted)) {
          holder.setPrincipal(new SimplePrincipal(user));
          return STATUS_CONTINUE_WITH_PRINCIPAL;
        }
      }
    }
    int attempts = getBasicAttempt(req);
    if (attempts > 2) {
      return STATUS_CONTINUE_CHAIN;
    }
    else {
      setBasicAttept(req, attempts + 1);
      resp.setHeader("WWW-Authenticate", "Basic realm=\"" + getRealm() + "\"");
      return STATUS_CONTINUE_CHAIN;
    }
  }

  private String getSalt(String username) throws ServletException {
    String result = null;
    Connection databaseConnection = null;
    PreparedStatement stmt = null;

    try {
      if (m_useJndiConnection) {
        databaseConnection = createJndiConnection();
      }
      else {
        databaseConnection = createJdbcDirectConnection();
      }

      stmt = databaseConnection.prepareStatement(m_selectSaltStatement);
      stmt.setString(1, username);
      stmt.execute();
      ResultSet resultSetSalt = stmt.getResultSet();
      while (resultSetSalt.next()) {
        result = resultSetSalt.getString("salt");
      }
    }
    catch (Exception e) {
      //LOG.error("Cannot SELECT user/pass.", e);
      throw new ServletException(e.getMessage(), e);
    }
    finally {
      try {
        if (stmt != null) {
          stmt.close();
          stmt = null;
        }
      }
      catch (SQLException e) {
        //LOG.warn("Exception in close stmt!", e);
      }
      try {
        if (databaseConnection != null) {
          databaseConnection.close();
          databaseConnection = null;
        }
      }
      catch (SQLException e) {
        //LOG.warn("Exception in close connection!", e);
      }
    }

    return result;
  }

  private String encryptPass(String pass) throws ServletException {
    String passEncrypted = null;
    if (pass != null) {
      try {
        passEncrypted = Base64Utility.encode(EncryptionUtility.signMD5(pass.getBytes()));
      }
      catch (NoSuchAlgorithmException e) {
        //LOG.error("couldn't create the password", e);
        throw new ServletException("couldn't create the password", e);
      }
    }
    return passEncrypted;
  }

  private int getBasicAttempt(HttpServletRequest req) {
    int basicAtttempt = 0;
    Object attribute = req.getSession().getAttribute(PROP_BASIC_ATTEMPT);
    if (attribute instanceof Integer) {
      basicAtttempt = ((Integer) attribute).intValue();
    }
    return basicAtttempt;
  }

  private void setBasicAttept(HttpServletRequest req, int attempts) {
    req.getSession().setAttribute(PROP_BASIC_ATTEMPT, attempts);
  }

  protected Connection createJdbcDirectConnection() throws ClassNotFoundException, SQLException {
    Class.forName(m_jdbcDriverName);
    return DriverManager.getConnection(m_jdbcMappingName, m_jdbcUserName, m_jdbcPassword);
  }

  protected Connection createJndiConnection() throws NamingException, SQLException {
    InitialContext initialContext = null;

    String jndiName = m_jndiName;
    String jndiInitialContextFactory = m_jndiInitialContextFactory;
    String jndiProviderUrl = m_jndiProviderUrl;
    String jndiUrlPkgPrefixes = m_jndiUrlPkgPrefixes;
    if (LOG.isInfoEnabled()) LOG.info("Opening rmi connection to: " + jndiName + "," + m_jdbcUserName);
    if (LOG.isInfoEnabled()) LOG.info("  using initial context factory: " + jndiInitialContextFactory);
    if (LOG.isInfoEnabled()) LOG.info("  using provider url: " + jndiProviderUrl);
    Hashtable<String, String> ht = new Hashtable<String, String>();
    if (jndiInitialContextFactory != null) {
      ht.put(Context.INITIAL_CONTEXT_FACTORY, jndiInitialContextFactory);
    }
    if (jndiProviderUrl != null) {
      ht.put(Context.PROVIDER_URL, jndiProviderUrl);
    }
    if (jndiUrlPkgPrefixes != null) {
      ht.put(Context.URL_PKG_PREFIXES, jndiUrlPkgPrefixes);
    }
    DataSource dataSource = null;
    if (ht.size() > 0) {
      initialContext = new InitialContext(ht);
    }
    else {
      initialContext = new InitialContext();
    }
    dataSource = (DataSource) initialContext.lookup(jndiName);
    // Grab a connection
    Connection conn;
    if (m_jdbcUserName != null && m_jdbcPassword != null) {
      conn = dataSource.getConnection(m_jdbcUserName, m_jdbcPassword);
    }
    else {
      conn = dataSource.getConnection();
    }
    conn.setAutoCommit(false);
    return conn;
  }

}

Re: Detect timeout [message #1072959 is a reply to message #1072916] Tue, 23 July 2013 21:00 Go to previous messageGo to next message
Eclipse UserFriend
I cannot see any issues in these two classes.
To get further you could add some log information to your ServerSession:
- in the constructor
- where the two members (MpxVestigingNaam, MpxDatabaseNummer) gets initialized.

It looks like there is a ServerSession around which is not properly initialized.

-andreas
Re: Detect timeout [message #1074191 is a reply to message #1072959] Fri, 26 July 2013 08:52 Go to previous message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 330
Registered: August 2011
Senior Member
Hi,

got some logging info:

// After login the ServerSession is created which is expected. I executed some actions so it is visible that the databaseNumber and VestigingNaam are set.

ServerSession now constructed
ServerSession.execLoadSession now called
ServerSession.setMpxDatabaseNummer now called
ServerSession.setMpxVestigingNaam now called
Database nummer in MpxSqlServiceProvider = 1
Database nummer in MpxSqlServiceProvider = 1
Database nummer in MpxSqlServiceProvider = 1

// now I waited until timeout exceeded

ServerSession now constructed
ServerSession.execLoadSession now called
Database nummer in MpxSqlServiceProvider = 0
Database nummer in MpxSqlServiceProvider not valid, find by vestigingName
Database nummer in MpxSqlServiceProvider = 0
Database nummer in MpxSqlServiceProvider not valid, find by vestigingName

After the time-out is exceeded and an actions are executed from the client a new ServerSession is automatically created. I think this is strange.

Regards Bertin




Previous Topic:Tri-state Checkboxes
Next Topic:Supporting disabled buttons and toggle buttons on the toolbar
Goto Forum:
  


Current Time: Thu Mar 28 15:04:55 GMT 2024

Powered by FUDForum. Page generated in 0.02429 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top