jiangyu1321 / memcached-session-manager

Automatically exported from code.google.com/p/memcached-session-manager
0 stars 0 forks source link

Common Loader / Shared Loader conflict at time of loading spymemcache #182

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

we are using version 1.6.5 with fedora OS.

We are facing a peculiar issue while trying to use memcache-session-manager 
project of yours.

We followed the instructions given and added required jars to tomcat/lib folder.

These jars are now by default loaded by common loader of tomcat.

Unfortunately, our in house jars are not placed in war's web-inf, instead we 
use shared loader to load these set of in house jars. Our in house jars also 
uses spy memcache client.

Problem we face is when our in house specific jars want to use 
spymemcacheclient then tomcat loads classes using common loader. We dont want 
this to happen, we want spymemcache provided in shared loader to be used.

Can you please, suggest any way or method by which we can accomplish that.

Any insights on this will be really helpful for us.

Thanks & regards,
Vishal Meghani

Original issue reported on code.google.com by VISH.THE...@gmail.com on 25 Nov 2013 at 1:37

GoogleCodeExporter commented 8 years ago
Are classes loaded by the shared loader available by the common loader? In this 
case can you try removing spymemcached from tomcat/lib?
Is there some documentation on the shared classloader btw? It's not documented 
in http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html (from my 
memory the shared loader existed in tomcat 4/5 or so).

Original comment by martin.grotzke on 25 Nov 2013 at 11:37

GoogleCodeExporter commented 8 years ago
Common loader does not have access to classes loaded by shared loader.

Shared loader is from legacy tomcat 5.x,and we are using this in tomcat 7 as of 
now.

You can refer to documentation on shared.loader at following link
http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html

Original comment by VISH.THE...@gmail.com on 26 Nov 2013 at 6:35

GoogleCodeExporter commented 8 years ago
Ok. An option would be to create a shaded msm jar (using the 
maven-shade-plugin) that bundles spymemcached (with relocated, renamed 
spymemcached classes).

Original comment by martin.grotzke on 26 Nov 2013 at 2:21

GoogleCodeExporter commented 8 years ago
Maven-shade could have been used but we got this working by overriding 
resolveClass of ObjectInputStream and using current thread classloader. Thanks 
for your help and suggestions Martin.

Original comment by VISH.THE...@gmail.com on 27 Nov 2013 at 8:50

GoogleCodeExporter commented 8 years ago
Great you solved it!

Original comment by martin.grotzke on 27 Nov 2013 at 10:20