Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/server/SessionManager
程序员文章站
2022-06-05 16:06:03
...
在使用JFinal框架2.2
jetty 8.18.v20121106版本时报错:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/server/SessionManager
at com.jfinal.server.ServerFactory.getServer(ServerFactory.java:44)
at com.jfinal.core.JFinal.start(JFinal.java:153)
at com.hankun.ServerStart.main(ServerStart.java:15)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.SessionManager
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
解决方案:
去掉jetty相关jar包中的标签
然后重新运行:
Starting JFinal 2.2
Starting scanner at interval of 5 seconds.
Starting web server on port: 8099
2019-10-28 16:40:42
[INFO]-[Thread: main]-[org.eclipse.jetty.server.Server.doStart()]: jetty-8.1.8.v20121106
Null identity service, trying login service: null
Finding identity service: null
2019-10-28 16:40:43
[INFO]-[Thread: main]-[org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized()]: started o.e.j.w.WebAppContext{/,file:/D:/05code/svn/trunk/mars/earth/src/main/webapp/}
2019-10-28 16:40:43
[INFO]-[Thread: main]-[org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized()]: started o.e.j.w.WebAppContext{/,file:/D:/05code/svn/trunk/mars/earth/src/main/webapp/}
2019-10-28 16:40:43
[INFO]-[Thread: MLog-Init-Reporter]-[com.mchange.v2.log.slf4j.Slf4jMLog$Slf4jMLogger$InfoLogger.log()]: MLog clients using slf4j logging.
2019-10-28 16:40:44
[INFO]-[Thread: main]-[com.mchange.v2.log.slf4j.Slf4jMLog$Slf4jMLogger$InfoLogger.log()]: Initializing c3p0-0.9.5.1 [built 16-June-2015 00:06:36 -0700; debug? true; trace: 10]
2019-10-28 16:40:44
[INFO]-[Thread: main]-[com.mchange.v2.log.slf4j.Slf4jMLog$Slf4jMLogger$InfoLogger.log()]: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 2, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> 2so1ica64v1q4a4ekdyg|28f3b248, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 2so1ica64v1q4a4ekdyg|28f3b248, idleConnectionTestPeriod -> 0, initialPoolSize -> 10, jdbcUrl -> jdbc:mysql://10.102.101.13/hkwork?characterEncoding=utf8, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 20, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 100, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 10, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
2019-10-28 16:40:46
[INFO]-[Thread: main]-[org.eclipse.jetty.server.AbstractConnector.doStart()]: Started SelectChannelConnector@0.0.0.0:8099
Starting Complete. Welcome To The JFinal World :)