[opencms-dev] Different version jars in lib folder

Paul-Inge Flakstad flakstad at npolar.no
Fri Apr 15 11:58:38 CEST 2011


Hi again Achim,

I should clearify that it isn't Tomcat that's throwing 
exceptions around, it's a JSP I wrote that's parsing XML 
files.

The JSP is fine until [something] happens (possibly a redeploy 
of the OpenCms webapp it resides in), then it starts throwing 
ClassCastExceptions. The first time I experienced this, I 
found differing jars in the lib/ folder of the OpenCms webapp. 
I took care of this, and thought that would be the end of it. 
This time, however, I cannot seem to find any "version 
conflict".

This is the reason I asked if different versions of a library 
can cause conflict when the versions reside in two different 
webapp/WEB-INF/lib folders/. I'm not sure if you noticed in 
my first e-mail that they were _different_ webapps?
webapp_one/WEB-INF/lib/mylibrary-v1.0.jar  <-- one webapp
webapp_two/WEB-INF/lib/mylibrary-v2.0.jar  <-- another webapp

I have 3 OpenCms instances running on the same Tomcat, they're 
version 7.5.2 and 7.5.3 (so not a huge difference). I 
restarted Tomcat last night, and everything was fine after 
that, but I don't know what will happen when I redeploy the 
webapp. 

I'll have a look at the link you gave me. Maybe I can make 
sense of things.

Thanks for your time and help, Achim - much appreciated! :)

Cheers,
Paul

> -----Original Message-----
> From: opencms-dev-bounces at opencms.org 
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Achim Westermann
> Sent: 15. april 2011 10:10
> To: The OpenCms mailing list
> Subject: Re: [opencms-dev] Different version jars in lib folder
> 
> Hi Paul,
> 
> > You're absolutely right, and memory serves you well - they 
> were 334 bytes indeed.
> 
> Uuuuh.... Yesssss!
> 
> >  From what you say, I gather it's risky to have different 
> versions of OpenCms on the same Tomcat, then? (Since they may 
> employ different version jars, which could cause conflict?)
> 
> I'd consider it a bug if tomcat runs into Classloading errors 
> if several 
> OpenCms versions are deployed to different webapplications. 
> But I am not 
> sure now if there might be a special case where this might 
> happen. The 
> mechanism of classloading is explained here: 
> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
> 
> HTH,
> Achim
> 
> > Cheers,
> > Paul
> >
> >> -----Original Message-----
> >> From: opencms-dev-bounces at opencms.org
> >> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of 
> Achim Westermann
> >> Sent: 14. april 2011 22:41
> >> To: The OpenCms mailing list
> >> Subject: Re: [opencms-dev] Different version jars in lib folder
> >>
> >> Hi Paul,
> >>
> >>> For example, all of these:
> >>> lucene-core-1.9.1.jar
> >>> lucene-core-2.1.0.jar
> >>> lucene-core-2.2.0.jar
> >>> lucene-core-2.3.1.jar
> >>> lucene-core-2.3.2.jar
> >>> lucene-core-2.4.1.jar
> >>
> >> Most often this is the case for OpenCms installations that have
> >> undergone at least one update. The setup routine will
> >> overwrite previous
> >> libraries with an empty jar file (size something like 334
> >> bytes, don't
> >> have this in memory) because in the past deletion of jar 
> files failed
> >> under some circumstances. It's OK to delete all the tiny jar files.
> >>
> >>> (Most of the commons-xxx jars, and a bunch of others as
> >> well, are also
> >>> present in multiple versions.)
> >>> What could be the cause of all these multiple versions? Is
> >> it safe to
> >>> delete the older versions and just keep the most recent?
> >>> On a side-note:
> >>> Can two different versions of the "same" jar cause
> >> conflicts, if they
> >>> reside in the separate webapps' lib folder?
> >>> For example:
> >>> webapp_one/WEB-INF/lib/mylibrary-v1.0.jar
> >>> webapp_two/WEB-INF/lib/mylibrary-v2.0.jar
> >>
> >> Indeed this can cause ClassCastExceptions. It's a matter of luck in
> >> which order the jar files are loaded by the ClassLoaders. Duplicate
> >> non-empty jar files have to be deleted as you described.
> >>
> >> HTH,
> >>
> >> Achim
> >>
> >>
> >> _______________________________________________
> >> This mail is sent to you from the opencms-dev mailing list
> >> To change your list options, or to unsubscribe from the list,
> >> please visit
> >> http://lists.opencms.org/mailman/listinfo/opencms-dev
> >>
> >
> > _______________________________________________
> > This mail is sent to you from the opencms-dev mailing list
> > To change your list options, or to unsubscribe from the 
> list, please visit
> > http://lists.opencms.org/mailman/listinfo/opencms-dev
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, 
> please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
> 


More information about the opencms-dev mailing list