Git Product home page Git Product logo

msm-sample-webapp's Introduction

A sample (wicket) webapp for playing with memcached-session-manager (msm). It comes with two tomcats (in runtime/) that are configured with msm+kryo (msm kryo-serializer) storing sessions in memcached.

This sample comes with two tomcat instances (in runtime/, tomcat1 and tomcat2) that are configured with msm+kryo (msm kryo-serializer) for non-sticky sessions by default.

To change the stickyness you can switch via ./switch-stickyness.sh sticky|nonsticky. Btw, there are 2 different tomcat versions available in runtime/ (6.0.32 and 7.0.8), you can switch them via ./switch-tomcat.sh 7.0.8 or ./switch-tomcat.sh 6.0.32.

Prerequisites

  1. Maven: you should have installed maven to be able to build the webapp.
  2. memcached: you should have installed memcached so that you can run the webapp with sessions replicated to memcached
  3. I don't mention java here :-)

Building the webapp / war file

  1. Build the web application: $ mvn package

Running the webapp

You can run the webapp using the preconfigured tomcats in runtime/. Before you start tomcat, make sure that you have started two memcached nodes: $ memcached -p 11211 -u memcached -m 64 -M -vv & $ memcached -p 11212 -u memcached -m 64 -M -vv & This is the cmd line that I'm using on my system with memcached installed using the memcached user. -vv tells memcached to write lots of stuff to stdout, so you'll see when a session is requested or stored in the output of memcached.

To start both tomcats just run $ ./runtime/tomcat1/bin/catalina.sh run & $ ./runtime/tomcat2/bin/catalina.sh run &

Now you can access both tomcats with your browser on http://localhost:8081/ and http://localhost:8082/. To simulate a loadbalancer in front of your tomcats and a session failover just request the same url on the other tomcat (just change to port in the url).

msm-sample-webapp's People

Contributors

magro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

msm-sample-webapp's Issues

NullPointerException

I follow the README.
mvn package
$ ./runtime/tomcat1/bin/catalina.sh run
http://localhost:8081/
Goto StatefulPage
got the error
ERROR - RequestLogger - Exception while determining the size of the session in the request logger: null
java.lang.NullPointerException
at java.util.Locale.writeObject(Locale.java:2043)
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:606)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
at org.apache.wicket.util.lang.Objects$SerializingObjectSizeOfStrategy.sizeOf(Objects.java:89)
at org.apache.wicket.util.lang.Objects.sizeof(Objects.java:1194)
at org.apache.wicket.Session.getSizeInBytes(Session.java:820)
at org.apache.wicket.protocol.http.RequestLogger.requestTime(RequestLogger.java:228)
at org.apache.wicket.RequestCycle.detach(RequestCycle.java:1163)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1454)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:312)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at de.javakaffee.web.msm.RequestTrackingContextValve.invoke(RequestTrackingContextValve.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at de.javakaffee.web.msm.RequestTrackingHostValve.invoke(RequestTrackingHostValve.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:744)
INFO - RequestLogger - time=254,event=BookmarkablePage[de.javakaffee.msm.bench.HomePage()],response=PageRequest[org.apache.wicket.markup.html.pages.ExceptionErrorPage(10)],sessionid=75B8D625FEE8317FEE8814BE167D301C,sessionsize=-1,sessionstart=Fri May 16 15:28:01 ICT 2014,requests=2,totaltime=254,activerequests=0,maxmem=1908M,total=128M,used=10M

running from eclipse - class not found KryoTranscoderFactory

App runs fine from command line, but while running from eclipse it gives error "eclipse java.lang.ClassNotFoundException: de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"

When I copied all libs from applications' WEB-INF/lin to runtime/tomcat/lib, then it started running fine from eclipse too.
Since these libs are not recommended to be copied under tomcat/lib, what is the best fix?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.