title: Trying apply spring-session on the glashfish container
body: <ol>
  <li><p>I developing one project using those techs:<br>
  a) Container: Glashfish;<br>
  b) Spring Security;<br>
  c) Java Server Faces;<br>
  d) MySQL.  </p></li>
  <li><p>Used code:  </p></li>
  </ol>
  
  <p>@WebListener
  public class HazelcastInitializer implements ServletContextListener {</p>
  
  <pre><code>private HazelcastInstance instance;
  
  @Override
  public void contextInitialized(ServletContextEvent sce) {
      String sessionMapName = "spring:session:sessions";
      ServletContext sc = sce.getServletContext();
  
      ClientConfig clientConfig = new ClientConfig();
      clientConfig.getGroupConfig().setName("value").setPassword("value-pass");
      clientConfig.getNetworkConfig().addAddress("ip");
      clientConfig.getNetworkConfig().setSmartRouting(true);
  
      Collection&lt;SerializerConfig&gt; scfg = new ArrayList&lt;SerializerConfig&gt;();
      SerializerConfig serializer = new SerializerConfig()
              .setTypeClass(Object.class)
              .setImplementation(new ObjectStreamSerializer());
      scfg.add(serializer);
      clientConfig.getSerializationConfig().setSerializerConfigs(scfg);
  
      instance = HazelcastClient.newHazelcastClient(clientConfig);
  
      Map&lt;String, ExpiringSession&gt; sessions = instance.getMap(sessionMapName);
  
      SessionRepository&lt;ExpiringSession&gt; sessionRepository
              = new MapSessionRepository(sessions);
      SessionRepositoryFilter&lt;ExpiringSession&gt; filter
              = new SessionRepositoryFilter&lt;ExpiringSession&gt;(sessionRepository);
      Dynamic fr = sc.addFilter("springSessionFilter", filter);
      fr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/*");
  }
  
  @Override
  public void contextDestroyed(ServletContextEvent sce) {
      if (instance != null) {
          instance.shutdown();
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <ol start="3">
  <li><strong><em>I saw this code connected to the Hazelcast server but not persisting the session. What i doing wrong ?</em></strong></li>
  </ol>