簡體   English   中英

碼頭會話集群ClassNotFoundException

[英]Jetty session clustering ClassNotFoundException

我正在使用http://www.eclipse.org/jetty/documentation/current/session-clustering-jdbc.html實現碼頭會話集群

我的jetty-jdbc-sessions.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>

</Configure>

Start.ini

# --------------------------------------- 
# Module: jdbc-sessions
--module=jdbc-sessions
## JDBC Session config

## Unique identifier for this node in the cluster
  jetty.jdbcSession.workerName=node1

## The interval in seconds between sweeps of the scavenger
# jetty.jdbcSession.scavenge=600

## Uncomment either the datasource name or driverClass and connectionURL
# jetty.jdbcSession.datasource=sessions
 jetty.jdbcSession.driverClass=com.mysql.jdbc.Driver
 jetty.jdbcSession.connectionURL=jdbc:mysql://127.0.0.1:3306/sessions;create=true

當我使用java -jar start.jar啟動碼頭時,出現異常

2016-03-23 22:36:49.124:WARN:oejuc.AbstractLifeCycle:main: FAILED org.eclipse.jetty.server.session.JDBCSessionIdManager
7591a3ed: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.eclipse.jetty.server.session.JDBCSessionIdManager.initializeDatabase(JDBCSessionIdManager.java:1496)
        at org.eclipse.jetty.server.session.JDBCSessionIdManager.doStart(JDBCSessionIdManager.java:985)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
        at org.eclipse.jetty.server.Server.start(Server.java:387)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
        at org.eclipse.jetty.server.Server.doStart(Server.java:354)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1255)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1174)
        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:321)
        at org.eclipse.jetty.start.Main.start(Main.java:817)

我在$ JETTY_HOME / lib目錄和$ JAVA_HOME / lib目錄中也有我的mysql jdbc驅動程序jar文件,所以我不確定為什么仍然出現錯誤

將MySQL JDBC驅動程序jar放在$JETTY_HOME/lib/ext目錄中。

我必須在start.init中添加--module = ext,以使碼頭處理來自lib / ext目錄的jar。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM