Not exactly correct. The article you are citing is quite old and assumes that class loaders always use a parent-first delegation policy. With that policy you would not get this ClassCastException. That follows from what they call the Uniqueness Principle. However, in Tomcat a webapp class loader uses a parent-last delegation policy. In that case the Uniqueness Principle is no longer applicable, and you can get a ClassCastException if the same JAR is loaded by the webapp class loader and placed in $CATALINA_HOME/lib.
Andreas On Thu, Jan 12, 2012 at 18:48, Okken,Brett <bok...@cerner.com> wrote: > Potentially. Having the same class loaded in differing class loaders can > cause issues if anything ever gets shared. Take a look at the "Classloader > Magic" section of this[1] article. > > [1] - http://www.objectsource.com/j2eechapters/Ch21-ClassLoaders_and_J2EE.htm > > Brett > > -----Original Message----- > From: John Watt [mailto:john.w...@glasgow.ac.uk] > Sent: Thursday, January 12, 2012 10:13 AM > To: java-user@axis.apache.org > Subject: RE: org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory > cannot be cast to org.apache.axiom.om.OMMetaFactory > > We definitely don't have different versions of the .jars, and a search of the > whole filesystem shows only the one version of the axiom jars. > > However, our Java client is running in the same Tomcat container as the > Axis2 service, so I copied some of the libs in the Axis2 lib directory to > $CATALINA_HOME/lib for the client to make use of them. Could this duplication > cause a problem like the one reported? > > Thanks! > John > > -----Original Message----- > From: Okken,Brett [mailto:bok...@cerner.com] > Sent: 12 January 2012 16:02 > To: java-user@axis.apache.org > Subject: RE: > org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory cannot be cast > to org.apache.axiom.om.OMMetaFactory > > I am guessing that you have some other version of one or more of those jars > in your classpath somewhere. In 1.2.10, OMLinkedListMetaFactory (in > axiom-api) directly implements OMMetaFactory (from axiom-api): > public class OMLinkedListMetaFactory implements OMMetaFactory This > changes in 1.2.11, where OMLinkedListMetaFactory extends > AbstractOMMetaFactory (from axiom-api): > public class OMLinkedListMetaFactory extends AbstractOMMetaFactory > > > Brett > > -----Original Message----- > From: John Watt [mailto:john.w...@glasgow.ac.uk] > Sent: Thursday, January 12, 2012 9:02 AM > To: java-user@axis.apache.org > Subject: RE: > org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory cannot be cast > to org.apache.axiom.om.OMMetaFactory > > Hi Brett, > > Its using > > axiom-api-1.2.10.jar > axiom-dom-1.2.10.jar > axiom-impl-1.2.10.jar > > Thanks, > John > > -----Original Message----- > From: Okken,Brett [mailto:bok...@cerner.com] > Sent: 12 January 2012 15:00 > To: java-user@axis.apache.org > Subject: RE: > org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory cannot be cast > to org.apache.axiom.om.OMMetaFactory > > What versions of the following projects are in your assembly: > axiom-api > axiom-dom > axiom-impl > > Brett Okken > > -----Original Message----- > From: John Watt [mailto:john.w...@glasgow.ac.uk] > Sent: Thursday, January 12, 2012 8:51 AM > To: java-user@axis.apache.org > Subject: FW: > org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory cannot be cast > to org.apache.axiom.om.OMMetaFactory > > Hi, > > I have an Axis2 web service which allows values to be set then retrieved > using separate methods. This service works fine in the browser. This service > is using axis2 1.5.3 and axiom 1.2.10. > > I then tried to run up a Java client (webClientBean, which is called from a > JSP page) using the same Axis2 library versions which programmatically calls > the service. Using the ServiceClient example at the following page: > > http://today.java.net/pub/a/today/2006/12/13/invoking-web-services-using > -apache-axis2.html > > I've created a client which is attached (webClientBean). > > I get the following error in Tomcat when it is invoked: > > org.apache.jasper.JasperException: java.lang.ClassCastException: > org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory cannot be cast > to org.apache.axiom.om.OMMetaFactory > > org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServle > tWrapper.java:491) > > org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja > va:419) > > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) > > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) > javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > > root cause > > java.lang.ClassCastException: > org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory cannot be cast > to org.apache.axiom.om.OMMetaFactory > > org.apache.axiom.om.OMAbstractFactory.getMetaFactory(OMAbstractFactory.j > ava:133) > > org.apache.axiom.om.OMAbstractFactory.getOMFactory(OMAbstractFactory.jav > a:152) > > org.apache.axis2.description.AxisDescription.<init>(AxisDescription.java > :70) > > org.apache.axis2.engine.AxisConfiguration.<init>(AxisConfiguration.java: > 160) > > org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(D > eploymentEngine.java:701) > > org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration( > FileSystemConfigurator.java:116) > > org.apache.axis2.context.ConfigurationContextFactory.createConfiguration > Context(ConfigurationContextFactory.java:64) > > org.apache.axis2.context.ConfigurationContextFactory.createConfiguration > ContextFromFileSystem(ConfigurationContextFactory.java:206) > > org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClie > nt.java:150) > > org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:143) > > org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:246) > vanguard2.webClientBean.callWebServiceSet(webClientBean.java:60) > org.apache.jsp.index_jsp._jspService(index_jsp.java:93) > > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) > javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > > org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja > va:377) > > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) > > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) > javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > > > Do you know what the problem is? I've had a look at the advice in > http://ws.apache.org/axiom/userguide/ch04.html with regard to Migrating from > older Axiom Versions, but I'm not sure if this is the problem, or how to fix > it. > > Thanks, > John > > Dr. John Watt > BSc.(Hons) Ph.D MInstP > Technical Director NeSC > > Direct Line: +44 (0)141 330 8647 > Fax: +44 (0)141 330 7305 > Mobile: 07545 500579 > Email: john.w...@glasgow.ac.uk > > National e-Science Centre > University of Glasgow > Room 246D, Kelvin Building > University Avenue > G12 8QQ > > The University of Glasgow, charity number SC004401 > > > ---------------------------------------------------------------------- > CONFIDENTIALITY NOTICE This message and any included attachments are from > Cerner Corporation and are intended only for the addressee. The information > contained in this message is confidential and may constitute inside or > non-public information under international, federal, or state securities > laws. Unauthorized forwarding, printing, copying, distribution, or use of > such information is strictly prohibited and may be unlawful. If you are not > the addressee, please promptly delete this message and notify the sender of > the delivery error by e-mail or you may call Cerner's corporate offices in > Kansas City, Missouri, U.S.A at (+1) (816)221-1024. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > For additional commands, e-mail: java-user-h...@axis.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > For additional commands, e-mail: java-user-h...@axis.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > For additional commands, e-mail: java-user-h...@axis.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > For additional commands, e-mail: java-user-h...@axis.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > For additional commands, e-mail: java-user-h...@axis.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org For additional commands, e-mail: java-user-h...@axis.apache.org