0 Replies Latest reply on Jun 3, 2015 1:09 PM by karansoni

    Using jetty-infinispan module

    karansoni

      Hi, I am trying to test jetty 9.3 with infinispan module using following link:

       

      https://eclipse.org/jetty/documentation/current/session-clustering-infinispan.html

       

      what I did is added configuration for InfinispanSessionManager in InfinispanSessionIdManager as below:

       

      <?xml version="1.0"?>

      <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">

       

      <Configure id="Server" class="org.eclipse.jetty.server.Server">

       

        <!-- ===================================================================== -->

        <!-- Get a reference to the default local cache.                           -->

        <!-- ===================================================================== -->

        <New id="local" class="org.infinispan.manager.DefaultCacheManager">

           <Get id="cache" name="cache"></Get>

        </New>

       

        <!-- ===================================================================== -->

        <!-- Get a reference to a hotrod client for a remote cache.               -->

        <!-- Change the name of the cache to match your setup.                    -->

        <!-- ===================================================================== -->

        <!--

        <New id="hotrodMgr" class="org.infinispan.client.hotrod.RemoteCacheManager">

          <Get id="cache" name="cache">sessions</Get>

        </New>

        -->

       

       

        <!-- ===================================================================== -->

        <!-- Configure a SessionIdManager with the cache selected above.          -->

        <!-- ===================================================================== -->

        <Set name="sessionIdManager">

          <New id="idMgr" class="org.eclipse.jetty.session.infinispan.InfinispanSessionIdManager">

            <Arg>

              <Ref refid="Server"/>

            </Arg>

            <Set name="workerName"><Property name="jetty.infinispanSession.workerName" default="node1"/></Set>

            <Set name="cache"><Ref refid="cache"/></Set>

          </New>

        </Set>

       

      <!-- Get a reference to the InfinispanSessionIdManager -->

      <Ref id="Server">

        <Call id="idMgr" name="getSessionIdManager"/>

      </Ref>

       

      <!-- Get a referencee to the Cache from the InfinispanSessionIdManager -->

      <Ref id="idMgr">

        <Get id="cache" name="cache"/>

      </Ref>

       

      <!-- Use the InfinispanSessionIdManager and Cache to setup up the InfinispanSessionManager -->

      <Set name="sessionHandler">

        <New class="org.eclipse.jetty.server.session.SessionHandler">

          <Arg>

            <New id="mgr" class="org.eclipse.jetty.session.infinispan.InfinispanSessionManager">

              <Set name="sessionIdManager">

                <Ref id="idMgr"/>

              </Set>

              <Set name="cache">

                <Ref id="cache">

                </Ref>

              </Set>

              <Set name="scavengeInterval">60</Set>

            </New>

          </Arg>

        </New>

      </Set>

      </Configure>

       

       

      when I try to start jetty I am getting error as below:

      Starting Jetty: StartLog to /opt/jetty/logs/start.log

      2015-06-03 08:56:59.054:INFO::main: Logging initialized @891ms

      2015-06-03 08:56:59.169:WARN:oejs.HomeBaseWarning:main: This instance of Jetty is not running from a separate {jetty.base} directory, this is not recommended.  See documentation at http://www.eclipse.org/jetty/documentation/current/startup.html

      Jun 03, 2015 8:57:00 AM org.infinispan.factories.GlobalComponentRegistry start

      INFO: ISPN000128: Infinispan version: Infinispan 'Hoptimus Prime' 7.1.1.Final

      2015-06-03 08:57:00.656:WARN:oejx.XmlConfiguration:main: Config error at <Set name="sessionHandler">|  <New class="org.eclipse.jetty.server.session.SessionHandler"><Arg>|      <New id="mgr" class="org.eclipse.jetty.session.infinispan.InfinispanSessionManager"><Set name="sessionIdManager">|          <Ref id="idMgr"/>|        </Set><Set name="cache">|          <Ref id="cache"/>|        </Set><Set name="scavengeInterval">60</Set></New>|    </Arg></New>|</Set> java.lang.NoSuchMethodException: class org.eclipse.jetty.server.Server.setSessionHandler(class org.eclipse.jetty.server.session.SessionHandler) in file:/opt/jetty/etc/jetty-infinispan.xml

      java.lang.reflect.InvocationTargetException

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

              at java.lang.reflect.Method.invoke(Unknown Source)

              at org.eclipse.jetty.start.Main.invokeMain(Main.java:214)

              at org.eclipse.jetty.start.Main.start(Main.java:446)

              at org.eclipse.jetty.start.Main.main(Main.java:75)

      Caused by: java.lang.NoSuchMethodException: class org.eclipse.jetty.server.Server.setSessionHandler(class org.eclipse.jetty.server.session.SessionHandler)

              at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:593)

              at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:413)

              at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:360)

              at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:261)

              at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1489)

              at java.security.AccessController.doPrivileged(Native Method)

              at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1426)

              ... 7 more