Tomcat Memcached dependencies bundled with WAR
I'm currently using memcached-tomcat-session-manager with Tomcat7 for session storage.
This is setup in the prescribed manner with the various memcached / transcoder / serializer JARs in $CATALINA_HOME/lib and $CATALINA_HOME/conf/context.xml with a <Manager> ... entry and works just fine.
A situation has arisen where I'd like to share some static properties of classes between my webapp and (my modified version of) memcached-session-manager. I believe with the current setup they are in separate classloaders, so sharing static resources between classes is not possible.
That led me to bundle all the dependencies with the /WEB_INF/lib and move the the <Manager ... definition to /META-INF/context.xml. This is not working, with Tomcat reporting:
portal_1 | 2018-12-21 01:26:27,291 [Portal] SEVERE {localhost-startStop-1} Digester Begin event threw exception
portal_1 | java.lang.ClassNotFoundException: de.javakaffee.web.msm.MemcachedBackupSessionManager
portal_1 | at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
portal_1 | at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
portal_1 | at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
portal_1 | at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:144)
portal_1 | at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1303)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
portal_1 | at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
portal_1 | at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1576)
portal_1 | at org.apache.catalina.startup.ContextConfig.processContextConfig(ContextConfig.java:644)
portal_1 | at org.apache.catalina.startup.ContextConfig.contextConfig(ContextConfig.java:606)
portal_1 | at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:842)
portal_1 | at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:399)
portal_1 | at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
portal_1 | at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
portal_1 | at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:388)
portal_1 | at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:103)
portal_1 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:135)
portal_1 | at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1018)
portal_1 | at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994)
portal_1 | at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
portal_1 | at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
portal_1 | at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2021)
portal_1 | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
portal_1 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
portal_1 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
portal_1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
portal_1 | at java.lang.Thread.run(Thread.java:748)
I'm confident the dependencies are bundled in the WAR. After reading through Tomcat 7 documentation, its not clear to me if what I'm doing is possible - having classes defined within the WARs context.xml that are not in $CATALINA_HOME/lib eg the applications classloader has not been created yet.
tomcat7 memcached
add a comment |
I'm currently using memcached-tomcat-session-manager with Tomcat7 for session storage.
This is setup in the prescribed manner with the various memcached / transcoder / serializer JARs in $CATALINA_HOME/lib and $CATALINA_HOME/conf/context.xml with a <Manager> ... entry and works just fine.
A situation has arisen where I'd like to share some static properties of classes between my webapp and (my modified version of) memcached-session-manager. I believe with the current setup they are in separate classloaders, so sharing static resources between classes is not possible.
That led me to bundle all the dependencies with the /WEB_INF/lib and move the the <Manager ... definition to /META-INF/context.xml. This is not working, with Tomcat reporting:
portal_1 | 2018-12-21 01:26:27,291 [Portal] SEVERE {localhost-startStop-1} Digester Begin event threw exception
portal_1 | java.lang.ClassNotFoundException: de.javakaffee.web.msm.MemcachedBackupSessionManager
portal_1 | at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
portal_1 | at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
portal_1 | at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
portal_1 | at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:144)
portal_1 | at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1303)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
portal_1 | at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
portal_1 | at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1576)
portal_1 | at org.apache.catalina.startup.ContextConfig.processContextConfig(ContextConfig.java:644)
portal_1 | at org.apache.catalina.startup.ContextConfig.contextConfig(ContextConfig.java:606)
portal_1 | at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:842)
portal_1 | at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:399)
portal_1 | at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
portal_1 | at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
portal_1 | at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:388)
portal_1 | at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:103)
portal_1 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:135)
portal_1 | at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1018)
portal_1 | at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994)
portal_1 | at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
portal_1 | at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
portal_1 | at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2021)
portal_1 | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
portal_1 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
portal_1 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
portal_1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
portal_1 | at java.lang.Thread.run(Thread.java:748)
I'm confident the dependencies are bundled in the WAR. After reading through Tomcat 7 documentation, its not clear to me if what I'm doing is possible - having classes defined within the WARs context.xml that are not in $CATALINA_HOME/lib eg the applications classloader has not been created yet.
tomcat7 memcached
add a comment |
I'm currently using memcached-tomcat-session-manager with Tomcat7 for session storage.
This is setup in the prescribed manner with the various memcached / transcoder / serializer JARs in $CATALINA_HOME/lib and $CATALINA_HOME/conf/context.xml with a <Manager> ... entry and works just fine.
A situation has arisen where I'd like to share some static properties of classes between my webapp and (my modified version of) memcached-session-manager. I believe with the current setup they are in separate classloaders, so sharing static resources between classes is not possible.
That led me to bundle all the dependencies with the /WEB_INF/lib and move the the <Manager ... definition to /META-INF/context.xml. This is not working, with Tomcat reporting:
portal_1 | 2018-12-21 01:26:27,291 [Portal] SEVERE {localhost-startStop-1} Digester Begin event threw exception
portal_1 | java.lang.ClassNotFoundException: de.javakaffee.web.msm.MemcachedBackupSessionManager
portal_1 | at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
portal_1 | at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
portal_1 | at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
portal_1 | at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:144)
portal_1 | at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1303)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
portal_1 | at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
portal_1 | at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1576)
portal_1 | at org.apache.catalina.startup.ContextConfig.processContextConfig(ContextConfig.java:644)
portal_1 | at org.apache.catalina.startup.ContextConfig.contextConfig(ContextConfig.java:606)
portal_1 | at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:842)
portal_1 | at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:399)
portal_1 | at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
portal_1 | at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
portal_1 | at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:388)
portal_1 | at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:103)
portal_1 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:135)
portal_1 | at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1018)
portal_1 | at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994)
portal_1 | at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
portal_1 | at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
portal_1 | at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2021)
portal_1 | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
portal_1 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
portal_1 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
portal_1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
portal_1 | at java.lang.Thread.run(Thread.java:748)
I'm confident the dependencies are bundled in the WAR. After reading through Tomcat 7 documentation, its not clear to me if what I'm doing is possible - having classes defined within the WARs context.xml that are not in $CATALINA_HOME/lib eg the applications classloader has not been created yet.
tomcat7 memcached
I'm currently using memcached-tomcat-session-manager with Tomcat7 for session storage.
This is setup in the prescribed manner with the various memcached / transcoder / serializer JARs in $CATALINA_HOME/lib and $CATALINA_HOME/conf/context.xml with a <Manager> ... entry and works just fine.
A situation has arisen where I'd like to share some static properties of classes between my webapp and (my modified version of) memcached-session-manager. I believe with the current setup they are in separate classloaders, so sharing static resources between classes is not possible.
That led me to bundle all the dependencies with the /WEB_INF/lib and move the the <Manager ... definition to /META-INF/context.xml. This is not working, with Tomcat reporting:
portal_1 | 2018-12-21 01:26:27,291 [Portal] SEVERE {localhost-startStop-1} Digester Begin event threw exception
portal_1 | java.lang.ClassNotFoundException: de.javakaffee.web.msm.MemcachedBackupSessionManager
portal_1 | at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
portal_1 | at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
portal_1 | at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
portal_1 | at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:144)
portal_1 | at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1303)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
portal_1 | at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
portal_1 | at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
portal_1 | at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
portal_1 | at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1576)
portal_1 | at org.apache.catalina.startup.ContextConfig.processContextConfig(ContextConfig.java:644)
portal_1 | at org.apache.catalina.startup.ContextConfig.contextConfig(ContextConfig.java:606)
portal_1 | at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:842)
portal_1 | at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:399)
portal_1 | at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
portal_1 | at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
portal_1 | at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:388)
portal_1 | at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:103)
portal_1 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:135)
portal_1 | at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1018)
portal_1 | at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994)
portal_1 | at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
portal_1 | at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
portal_1 | at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2021)
portal_1 | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
portal_1 | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
portal_1 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
portal_1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
portal_1 | at java.lang.Thread.run(Thread.java:748)
I'm confident the dependencies are bundled in the WAR. After reading through Tomcat 7 documentation, its not clear to me if what I'm doing is possible - having classes defined within the WARs context.xml that are not in $CATALINA_HOME/lib eg the applications classloader has not been created yet.
tomcat7 memcached
tomcat7 memcached
edited Dec 21 '18 at 2:01
markdsievers
asked Dec 21 '18 at 1:56
markdsieversmarkdsievers
4,24663771
4,24663771
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
memcached-session-manager (msm) jars must reside in $CATALINA_HOME/lib because they're using tomcat internal classes (which is not possible from within the webapp). More concretely, these jar are memcached-session-manager.jar, memcached-session-manager-tc7.jar and spymemcached.jar.
The only msm related jars that must be put in /WEB_INF/lib are serialization related jars such as msm-kryo-serializer (usually defined as dependencies in your maven/gradle/xyz build), because they must be able to access application specific classes.
See also the related msm documentation.
Regarding your goal to share information between msm and your application: Because msm jars must reside in $CATALINA_HOME/lib, conceptually it's not possible to statically "link" application code with msm code (except msm serializer related code). This is only possible with an additional indirection: the definition of some interface inside msm, where the application provides an implementation and which msm then loads via reflection. This is how serializers are hooked into msm, see the TranscoderFactory interface (loaded from $CATALINA_HOME/lib) and the KryoTranscoderFactory implementation (loaded from /WEB_INF/lib).
Awesome, thanks for answering Martin.
– markdsievers
Jan 2 at 2:04
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53878279%2ftomcat-memcached-dependencies-bundled-with-war%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
memcached-session-manager (msm) jars must reside in $CATALINA_HOME/lib because they're using tomcat internal classes (which is not possible from within the webapp). More concretely, these jar are memcached-session-manager.jar, memcached-session-manager-tc7.jar and spymemcached.jar.
The only msm related jars that must be put in /WEB_INF/lib are serialization related jars such as msm-kryo-serializer (usually defined as dependencies in your maven/gradle/xyz build), because they must be able to access application specific classes.
See also the related msm documentation.
Regarding your goal to share information between msm and your application: Because msm jars must reside in $CATALINA_HOME/lib, conceptually it's not possible to statically "link" application code with msm code (except msm serializer related code). This is only possible with an additional indirection: the definition of some interface inside msm, where the application provides an implementation and which msm then loads via reflection. This is how serializers are hooked into msm, see the TranscoderFactory interface (loaded from $CATALINA_HOME/lib) and the KryoTranscoderFactory implementation (loaded from /WEB_INF/lib).
Awesome, thanks for answering Martin.
– markdsievers
Jan 2 at 2:04
add a comment |
memcached-session-manager (msm) jars must reside in $CATALINA_HOME/lib because they're using tomcat internal classes (which is not possible from within the webapp). More concretely, these jar are memcached-session-manager.jar, memcached-session-manager-tc7.jar and spymemcached.jar.
The only msm related jars that must be put in /WEB_INF/lib are serialization related jars such as msm-kryo-serializer (usually defined as dependencies in your maven/gradle/xyz build), because they must be able to access application specific classes.
See also the related msm documentation.
Regarding your goal to share information between msm and your application: Because msm jars must reside in $CATALINA_HOME/lib, conceptually it's not possible to statically "link" application code with msm code (except msm serializer related code). This is only possible with an additional indirection: the definition of some interface inside msm, where the application provides an implementation and which msm then loads via reflection. This is how serializers are hooked into msm, see the TranscoderFactory interface (loaded from $CATALINA_HOME/lib) and the KryoTranscoderFactory implementation (loaded from /WEB_INF/lib).
Awesome, thanks for answering Martin.
– markdsievers
Jan 2 at 2:04
add a comment |
memcached-session-manager (msm) jars must reside in $CATALINA_HOME/lib because they're using tomcat internal classes (which is not possible from within the webapp). More concretely, these jar are memcached-session-manager.jar, memcached-session-manager-tc7.jar and spymemcached.jar.
The only msm related jars that must be put in /WEB_INF/lib are serialization related jars such as msm-kryo-serializer (usually defined as dependencies in your maven/gradle/xyz build), because they must be able to access application specific classes.
See also the related msm documentation.
Regarding your goal to share information between msm and your application: Because msm jars must reside in $CATALINA_HOME/lib, conceptually it's not possible to statically "link" application code with msm code (except msm serializer related code). This is only possible with an additional indirection: the definition of some interface inside msm, where the application provides an implementation and which msm then loads via reflection. This is how serializers are hooked into msm, see the TranscoderFactory interface (loaded from $CATALINA_HOME/lib) and the KryoTranscoderFactory implementation (loaded from /WEB_INF/lib).
memcached-session-manager (msm) jars must reside in $CATALINA_HOME/lib because they're using tomcat internal classes (which is not possible from within the webapp). More concretely, these jar are memcached-session-manager.jar, memcached-session-manager-tc7.jar and spymemcached.jar.
The only msm related jars that must be put in /WEB_INF/lib are serialization related jars such as msm-kryo-serializer (usually defined as dependencies in your maven/gradle/xyz build), because they must be able to access application specific classes.
See also the related msm documentation.
Regarding your goal to share information between msm and your application: Because msm jars must reside in $CATALINA_HOME/lib, conceptually it's not possible to statically "link" application code with msm code (except msm serializer related code). This is only possible with an additional indirection: the definition of some interface inside msm, where the application provides an implementation and which msm then loads via reflection. This is how serializers are hooked into msm, see the TranscoderFactory interface (loaded from $CATALINA_HOME/lib) and the KryoTranscoderFactory implementation (loaded from /WEB_INF/lib).
answered Jan 2 at 0:01
MartinGrotzkeMartinGrotzke
1,266813
1,266813
Awesome, thanks for answering Martin.
– markdsievers
Jan 2 at 2:04
add a comment |
Awesome, thanks for answering Martin.
– markdsievers
Jan 2 at 2:04
Awesome, thanks for answering Martin.
– markdsievers
Jan 2 at 2:04
Awesome, thanks for answering Martin.
– markdsievers
Jan 2 at 2:04
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53878279%2ftomcat-memcached-dependencies-bundled-with-war%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown