1 2 3 4 Previous Next 45 Replies Latest reply on Mar 3, 2014 6:28 AM by christinaktm

    memcached session manager and jboss

    bone

      From what I'v read the JBoss6 JBossWeb is based on TomCat6 but it looks a bit different.

       

      I'd like to use the memcached session manager, is there a way to set it up?

      http://code.google.com/p/memcached-session-manager/wiki/SetupAndConfiguration

       

      I'm still learning jboss, would be nice if there is a solution without changing a lot of code

        • 1. memcached session manager and jboss
          martin.grotzke

          As you want to modify tomcats context.xml to configure msm the first question is which one is relevant to you / where to find it.

           

          Cheers,

          Martin

          1 of 1 people found this helpful
          • 2. Re: memcached session manager and jboss
            bone

            I'm want to set up a small test like the example on your msm-site (2 server, 2 memcache)

             

            what I've done so far:

            -copied default

            -added this to deploy\jbossweb.sar\context.xml

            {code:xml}

                <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"

                memcachedNodes="n1:localhost:11211 n2:localhost:11212"

                failoverNodes="n1"

                requestUriIgnorePattern=".*\.(png|gif|jpg|css|js)$"

                transcoderFactoryClass="de.javakaffee.web.msm.JavaSerializationTranscoderFactory"

                />

            {code}

            -added to lib folder

            tomcat-juli.jar (it was missing, don't know why)

            memcached-session-manager-1.4.0.jar

            memcached-2.5.jar

             

            when I'm trying to start it now, I'm getting:

            10:17:42,539 INFO  [TomcatDeployment] deploy, ctxPath=/invoker

            10:17:42,836 ERROR [StandardContext] Context [/invoker] startup failed due to previous errors: java.lang.NoSuchFieldError: log

                at de.javakaffee.web.msm.MemcachedBackupSessionManager.start(MemcachedBackupSessionManager.java:1421) [:]

                at org.apache.catalina.core.StandardContext.start(StandardContext.java:3837) [:6.0.0.Final]

            • 3. Re: memcached session manager and jboss
              jfclere

              They used log instead _log in the init() code... Complain to them

              • 4. Re: memcached session manager and jboss
                martin.grotzke

                Hi David,

                 

                I'm the creator of memcached-session-manager and would like to help in bringing msm and jboss together.

                As I'm new to jboss it would be helpful if you could provide a step by step guide how to reproduce it. Starting with the jboss version to download, which files to copy from directory X to directory Z (you copied "default" from where to where?), and also how you're running it.

                Otherwise it would take too much time for me and I might do different things than you.

                 

                Cheers,

                Martin

                • 5. Re: memcached session manager and jboss
                  martin.grotzke

                  Hi JF,

                   

                  the field log is defined by tomcats ManagerBase which is extended by MemcachedBackupSessionManager. You're right that the inconsistency of log and _log could be fixed. Still, in a normal tomcat installation it does work (as expected), so I wonder what's different in the tomcat bundled with jboss.

                   

                  Do you have a clue what's wrong here? Can you tell which tomcat version comes with jboss 6?

                   

                  Cheers,

                  Martin

                  • 6. Re: memcached session manager and jboss
                    martin.grotzke

                    Hi David,

                     

                    I just changed the log stuff to _log, you can get the jar here:

                    http://dl.dropbox.com/u/1439289/memcached-session-manager-1.4.2-SNAPSHOT.jar

                     

                    Perhaps this already does the trick.

                     

                    Cheers,

                    Martin

                    1 of 1 people found this helpful
                    • 7. Re: memcached session manager and jboss
                      jfclere

                      Do you have a clue what's wrong here? Can you tell which tomcat version comes with jboss 6?

                      Jboss uses org.jboss.logging.Logger and not org.apache.juli.logging.Log that is why you get the error.

                      I think to make a jbossweb version you should just add the dependencies to jbossweb and jbosslogging and rebuild your package.

                      • 8. memcached session manager and jboss
                        bone

                        Hi Martin,

                         

                        this really did the trick, the server is now running and connected to two memcache servers. Now I only have to write a quick tes programm. I'm going to post a quick guide here as soon as it is working.

                         

                        Thanks

                        David

                        • 9. Re: memcached session manager and jboss
                          martin.grotzke

                          Jean-Frederic Clere wrote:

                           

                          Jboss uses org.jboss.logging.Logger and not org.apache.juli.logging.Log that is why you get the error.

                          I think to make a jbossweb version you should just add the dependencies to jbossweb and jbosslogging and rebuild your package.

                          Ok, so jboss does not "bundle" tomcat as-is, but comes with a modified tomcat? Are other things changed besides logging? Is there any patch I can have a look at, or how are the tomcat sources modified?

                           

                          Cheers,

                          Martin

                          • 10. Re: memcached session manager and jboss
                            martin.grotzke

                            this really did the trick, the server is now running and connected to two memcache servers. Now I only have to write a quick tes programm. I'm going to post a quick guide here as soon as it is working.

                            Great!

                             

                            Are you interested in a msm version for jbossweb, that can be used out-of-the-box (as JF suggested)?

                            I'm already working on a new project structure of msm that allows to create a jbossweb version without too much effort.

                             

                            Cheers,

                            Martin

                            • 11. Re: memcached session manager and jboss
                              jfclere

                              Ok, so jboss does not "bundle" tomcat as-is, but comes with a modified tomcat? Are other things changed besides logging? Is there any patch I can have a look at, or how are the tomcat sources modified?

                              It is a forked version of Tomcat. The repository is http://anonsvn.jboss.org/repos/jbossweb/

                              • 12. Re: memcached session manager and jboss
                                martin.grotzke

                                It is a forked version of Tomcat. The repository is http://anonsvn.jboss.org/repos/jbossweb/

                                Thanx, I'll have a look at it and see if I can create a jboss version of msm.

                                 

                                Cheers,

                                Martin

                                • 13. Re: memcached session manager and jboss
                                  bone

                                  Hi again,

                                   

                                  I've written a very small servlet, packed it into a war and deployed it.

                                   

                                  {code}

                                  import java.io.IOException;

                                  import java.io.PrintWriter;

                                   

                                  import javax.servlet.ServletException;

                                  import javax.servlet.http.HttpServlet;

                                  import javax.servlet.http.HttpServletRequest;

                                  import javax.servlet.http.HttpServletResponse;

                                  import javax.servlet.http.HttpSession;

                                   

                                   

                                  public final class SessionTest extends HttpServlet {

                                   

                                      private static final long serialVersionUID = 1L;

                                   

                                      public void doPost(HttpServletRequest request, HttpServletResponse response)

                                      throws ServletException, IOException {

                                   

                                          HttpSession session = request.getSession(false);

                                          PrintWriter out = response.getWriter();

                                   

                                          if (session != null) {

                                              Integer rnd = (Integer) session.getAttribute("random");

                                              System.out.println("session found " + session.getId() + " load random=" + rnd);

                                              out.write("session found " + session.getId() + " load random=" + rnd);

                                          }

                                          else {

                                              int rnd = (int) (Math.random() * 100);

                                              session = request.getSession(true);

                                              session.setAttribute("random", Integer.valueOf(rnd));

                                              System.out.println("no session found, new " + session.getId() + "created and " + rnd + " saved");

                                              out.write("no session found, new " + session.getId() + "created and " + rnd + " saved");

                                   

                                          }

                                   

                                      }

                                   

                                      public void doGet(HttpServletRequest request, HttpServletResponse response)

                                      throws ServletException, IOException {

                                   

                                          doPost(request, response);

                                      }

                                  }

                                  {code}

                                   

                                  when I use call http://127.0.0.1:8080/sessiontest/test.html now, I'm getting:

                                   

                                  {code}

                                  15:28:35,745 ERROR [org.apache.catalina.connector.CoyoteAdapter] An exception or error occurred in the container during the request processi

                                  ng: java.lang.NoSuchFieldError: thisAccessedTime

                                          at de.javakaffee.web.msm.MemcachedBackupSession.wasAccessedSinceLastBackupCheck(MemcachedBackupSession.java:311) [:]

                                          at de.javakaffee.web.msm.BackupSessionService.backupSession(BackupSessionService.java:189) [:]

                                          at de.javakaffee.web.msm.MemcachedBackupSessionManager.backupSession(MemcachedBackupSessionManager.java:896) [:]

                                          at de.javakaffee.web.msm.SessionTrackerValve.backupSession(SessionTrackerValve.java:238) [:]

                                          at de.javakaffee.web.msm.SessionTrackerValve.invoke(SessionTrackerValve.java:149) [:]

                                          at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]

                                          at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]

                                          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]

                                          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]

                                   

                                          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.Final]

                                          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.Final]

                                          at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]

                                          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.Final]

                                          at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Fina

                                  l]

                                          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.Final]

                                          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.Final]

                                          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.0.0.Final]

                                          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.Final]

                                          at java.lang.Thread.run(Thread.java:662) [:1.6.0_23]

                                   

                                  15:28:39,844 ERROR [org.apache.catalina.core.ContainerBase] Exception invoking periodic operation: : java.lang.NoSuchFieldError: thisAccesse

                                  dTime

                                          at de.javakaffee.web.msm.MemcachedBackupSession.wasAccessedSinceLastBackup(MemcachedBackupSession.java:289) [:]

                                          at de.javakaffee.web.msm.MemcachedBackupSessionManager.updateExpirationInMemcached(MemcachedBackupSessionManager.java:1597) [:]

                                          at de.javakaffee.web.msm.MemcachedBackupSessionManager.backgroundProcess(MemcachedBackupSessionManager.java:1574) [:]

                                          at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1314) [:6.0.0.Final]

                                          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1599) [:6.0.0.Final]

                                          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1608) [:6.0.0.Final]

                                          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1608) [:6.0.0.Final]

                                          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1588) [:6.0.0.Final]

                                          at java.lang.Thread.run(Thread.java:662) [:1.6.0_23]

                                  {code}

                                   

                                  I've attached the war file.

                                  • 14. Re: memcached session manager and jboss
                                    martin.grotzke

                                    I think to make a jbossweb version you should just add the dependencies to jbossweb and jbosslogging and rebuild your package.

                                    I don't find a jbossweb 6.x artifact, only some 3.x (jboss.web.jbossweb) or 7.x (org.jboss.web), using the nexus search.

                                     

                                    Can you point me to the dependency spec (groupId:artifactId:version) and a repository that I need to include for jboss6 jbossweb?

                                     

                                    Thanx && cheers,

                                    Martin

                                    1 2 3 4 Previous Next