[opencms-dev] Different version jars in lib folder
Paul-Inge Flakstad
flakstad at npolar.no
Sun Apr 17 13:17:00 CEST 2011
Hi again,
While this is (probably) not an OpenCms issue, I'm hoping someone can help me.
I have 3 OpenCms instances on my Tomcat, all use
- xml-apis-2.9.1.jar
- xercesImpl-2.9.1.jar
When I (re)start Tomcat, no problems. But when I do a hot redeploy of one of the OpenCms instances, a JSP I wrote (it parses an XML) throws this:
java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration: null
com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:294)
...
Does anyone have ideas about why this is happening???
I thought this had to be due to conflicting versions of xerces, so in order to find my relevant libraries, I ran this (standing in ${TOMCAT_HOME}):
find . -name *xml-apis*
and
find . -name *xerces*
Only the libraries in the OpenCms webapps' lib/ folders (xml-apis-2.9.1.jar and xercesImpl-2.9.1.jar) are found. So, as far as I can tell, there is no conflict..! (Unless there are other libraries I should also check for differing versions?)
I would very much appreciate _any_ help - I've read everything I could find online, but can't get to the bottom of this... :(
Best regards,
Paul
________________________________________
Fra: opencms-dev-bounces at opencms.org [opencms-dev-bounces at opencms.org] på vegne av Paul-Inge Flakstad [flakstad at npolar.no]
Sendt: 15. april 2011 17:12
Til: The OpenCms mailing list
Emne: Re: [opencms-dev] Different version jars in lib folder
Update:
Confirmed that redeployment of the particular OpenCms webapp
causes ClassCastExceptions to re-appear.
Paul
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of
> Paul-Inge Flakstad
> Sent: 15. april 2011 11:59
> To: The OpenCms mailing list
> Subject: Re: [opencms-dev] Different version jars in lib folder
>
> 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
> >
>
> _______________________________________________
> 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