2016-06-28 42 views
0

我試圖使用數據庫配置碼頭會話羣集。有沒有辦法更改數據庫名稱。我不想使用默認名稱「會話」。另外我想要更改sessionidtable和sessiontable的表名,但我在使用xml設置配置時遇到了問題。在這裏我的代碼:使用XML的碼頭會話羣集

<?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"> 


    <!-- ===================================================================== --> 
    <!-- Configure a SessionIdManager           --> 
    <!-- ===================================================================== --> 
    <Set name="sessionIdManager"> 
    <New id="idMgr" class="org.eclipse.jetty.server.session.JDBCSessionIdManager"> 
     <Arg> 
     <Ref refid="Server"/> 
     </Arg> 
     <Set name="workerName"><Property name="jetty.jdbcSession.workerName" default="node1"/></Set> 
     <Set name="scavengeInterval"><Property name="jetty.jdbcSession.scavenge" default="1800"/></Set> 

     <!-- ===================================================================== --> 
     <!-- Uncomment either the datasource or driver setup and configure   --> 
     <!-- ===================================================================== --> 

     <!-- 
      <Set name="DatasourceName"><Property name="jetty.jdbcSession.datasource" default="javax.sql.DataSource/default"/></Set> 
      <Call name="setDriverInfo"> 
      <Arg><Property name="jetty.jdbcSession.driverClass"/></Arg> 
      <Arg><Property name="jetty.jdbcSession.connectionURL"/></Arg> 
     </Call> 
     --> 

    </New> 
    </Set> 

    <New id="idTableSchema " class="org.eclipse.jetty.server.session.SessionTableSchema"> 
    <Set name="setTableName">mysession</Set> 
    </New> 

</Configure> 

但在日誌中它說:

產生的原因:在java.net.URLClassLoader的org.eclipse.jetty.server.session.SessionTableSchema :拋出java.lang.ClassNotFoundException (未知源) at java.net.URLClassLoader $ 1.run(未知源) .lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.eclipse.jetty.util.Loader.loadClass(Loader.java:86) at org.eclipse.jetty.xml.XmlConfiguration $ JettyXmlConfiguration.nodeClass(XmlConfiguration.java:364) at org.eclipse.jetty。 xml.XmlConfiguration $ JettyXmlConfiguration.newObj(XmlConfiguration.java:754) at org.eclipse.jetty.xml.XmlConfiguration $ JettyXmlConfiguration.configure(XmlConfiguration.java:423) at org.eclipse.jetty.xml.XmlConfiguration $ JettyXmlConfiguration。配置(XmlConfiguration.java:354) at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:262) at org.eclipse.jetty.xml.XmlConfiguration $ 1.run(XmlConfiguration.java:1243) 在java.security.AccessController.doPrivileged(Native Method) at org.eclipse.j etty.xml.XmlConfiguration.main(XmlConfiguration.java:1174) ... 7個

回答

0

嘗試

<Set name="sessionTableSchema"> 
    <New id="tableSchema" class="org.eclipse.jetty.server.session.JDBCSessionIdManager$SessionTableSchema"> 
    <Set name="tableName">mysession</Set> 
    </New> 
</set> 

它說org.eclipse.jetty.server.session.SessionTableSchema碼頭文檔中但鏈接被破壞。上面的代碼是我能夠使其工作並匹配API文檔的唯一方法。 id表格處理非常相似。

http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/server/session/JDBCSessionIdManager.html