2

我刚刚关注了 Jetty docs about session clustering with a database并得到了这个异常:

java.lang.NoSuchMethodException: class  org.eclipse.jetty.server.session.JDBCSessionManager.setIdManager(class org.eclipse.jetty.server.session.JDBCSessionIdManager)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:582)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:411)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(XmlConfiguration.java:815)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.itemValue(XmlConfiguration.java:1125)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.value(XmlConfiguration.java:1030)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(XmlConfiguration.java:775)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.itemValue(XmlConfiguration.java:1125)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.value(XmlConfiguration.java:1030)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:457)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:411)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:298)
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:248)
at org.eclipse.jetty.webapp.JettyWebXmlConfiguration.configure(JettyWebXmlConfiguration.java:102)
at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:466)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:745)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)

这是我的 jetty.xml 文件中的 JDBCSessionIdManager:

<Configure id="Server" class="org.eclipse.jetty.server.Server">
     :
  <New id="DSClustering" class="org.eclipse.jetty.plus.jndi.Resource">
     <Arg>jdbc/DSClustering</Arg>
     <Arg>
      <New class="com.mchange.v2.c3p0.ComboPooledDataSource">
         <Set name="driverClass">com.mysql.jdbc.Driver</Set>
         <Set name="jdbcUrl">jdbc:mysql://172.23.35.151:3306/sessions</Set>
         <Set name="user">jetty</Set>
         <Set name="password">jetty123</Set>
      </New>
     </Arg>
  </New>
 <Set name="sessionIdManager">
     <New id="jdbcidmgr" class="org.eclipse.jetty.server.session.JDBCSessionIdManager">
         <Arg><Ref refid="Server"/></Arg>
         <Set name="workerName">jettySessions</Set>
         <Set name="DatasourceName">jdbc/DSClustering</Set>
         <Set name="scavengeInterval">60</Set>
       </New>
 </Set>
 <Call name="setAttribute">
       <Arg>jdbcIdMgr</Arg>
       <Arg><Ref id="jdbcidmgr"/></Arg>
 </Call>
  :
</Configure>

这是我的 jetty-web.xml 文件:

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
    <Get name="server">
        <Get id="jdbcIdMgr" name="sessionIdManager" />
    </Get>
    <Set name="sessionHandler">
        <New class="org.eclipse.jetty.server.session.SessionHandler">
            <Arg>
                <New class="org.eclipse.jetty.server.session.JDBCSessionManager">
                    <Set name="idManager">
                        <Ref refid="jdbcIdMgr" />
                    </Set>
                </New>
            </Arg>
        </New>
    </Set>
</Configure>

我错过了什么???

4

0 回答 0