我想部署一個Grails應用程序到Tomcat 8.0.15。如果有問題,操作系統是CentOS 7,Java版本是1.7.0_71,memcached版本是1.4.20。Memcached和Tomcat 8不兼容
我使用Grails Standalone Tomcat plugin來使用memcached作爲會話管理器,它在Tomcat 7中運行良好。不幸的是,遷移到Tomcat 8並不像預期那麼簡單。
我發現這個公司的依賴關係中:de.javakaffee.msm:memcached-session-manager-tc7:1.6.4
,所以我試圖將其更改爲tc8
(存在於Maven)和更新各種其他插件的版本。
不幸的是,我碰到一個問題就來了,同時部署在Tomcat 8應用:
04-Feb-2015 16:26:08.371 INFO [http-nio-8080-exec-17] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /opt/tomcat/webapps/ROOT.war
2015-02-04 16:26:18 ERROR [GrailsContextLoaderListener] Error initializing the application: loader constraint violation: when resolving overridden method "de.javakaffee.web.msm.MemcachedBackupSessionManager.changeSessionId(Lorg/apache/catalina/Session;)V" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, de/javakaffee/web/msm/MemcachedBackupSessionManager, and its superclass loader (instance of java/net/URLClassLoader), have different Class objects for the type ger.changeSessionId(Lorg/apache/catalina/Session;)V used in the signature
java.lang.LinkageError: loader constraint violation: when resolving overridden method "de.javakaffee.web.msm.MemcachedBackupSessionManager.changeSessionId(Lorg/apache/catalina/Session;)V" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, de/javakaffee/web/msm/MemcachedBackupSessionManager, and its superclass loader (instance of java/net/URLClassLoader), have different Class objects for the type ger.changeSessionId(Lorg/apache/catalina/Session;)V used in the signature
at java.lang.Class.privateGetDeclaredMethods(Class.java:2615)
at java.lang.Class.getDeclaredMethods(Class.java:1860)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
總之,有一個叫changeSessionId
方法,它是由類de.javakaffee.web.msm.MemcachedBackupSessionManager
覆蓋,但是它有一些不同於什麼類加載器期待。
我在Google上找不到任何幫助,並嘗試更改很多版本和依賴項,結果無濟於事,所以我決定回滾到Tomcat 7.但是我想在此留下此情況,以免有人找到解決方案。
是的,我知道。我在問題中說過,我嘗試將插件的依賴項更改爲Tomcat8的jar,但它沒有工作:( – mathifonseca