Return-Path: X-Original-To: apmail-chemistry-dev-archive@www.apache.org Delivered-To: apmail-chemistry-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2E5B218E0E for ; Sat, 14 Nov 2015 13:34:19 +0000 (UTC) Received: (qmail 82458 invoked by uid 500); 14 Nov 2015 13:34:19 -0000 Delivered-To: apmail-chemistry-dev-archive@chemistry.apache.org Received: (qmail 82401 invoked by uid 500); 14 Nov 2015 13:34:18 -0000 Mailing-List: contact dev-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list dev@chemistry.apache.org Received: (qmail 82390 invoked by uid 99); 14 Nov 2015 13:34:18 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 14 Nov 2015 13:34:18 +0000 Received: from mail-yk0-f173.google.com (mail-yk0-f173.google.com [209.85.160.173]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 56AF51A04DE for ; Sat, 14 Nov 2015 13:34:18 +0000 (UTC) Received: by ykba77 with SMTP id a77so184676070ykb.2 for ; Sat, 14 Nov 2015 05:34:17 -0800 (PST) X-Received: by 10.129.51.82 with SMTP id z79mr25983227ywz.198.1447508057689; Sat, 14 Nov 2015 05:34:17 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Grant Ingersoll Date: Sat, 14 Nov 2015 13:34:08 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Jarhell To: "dev@chemistry.apache.org" Content-Type: multipart/alternative; boundary=001a11419ed29697970524803b1e --001a11419ed29697970524803b1e Content-Type: text/plain; charset=UTF-8 Debugging deeper, the issue is in the context class loaders in ClassLoaderUtil try { return loadClass(className, ccl); } catch (ClassNotFoundException cnf) { return loadClass(className, null); } The second loadClass method there properly loads the class (when forced to), the first one is where the exception is occurring. On Sat, Nov 14, 2015 at 8:23 AM Grant Ingersoll wrote: > But wait, there's more: > > Here's the code in question: > XMLInputFactory factory; > > try { > // Woodstox is the only supported and tested StAX > implementation > WstxInputFactory wstxFactory = (WstxInputFactory) > ClassLoaderUtil.loadClass( > "com.ctc.wstx.stax.WstxInputFactory").newInstance(); > wstxFactory.configureForSpeed(); > > factory = wstxFactory; > } catch (Exception e) { > // other StAX implementations may work, too > factory = XMLInputFactory.newInstance(); > > try { > // for the SJSXP parser > factory.setProperty("reuse-instance", Boolean.FALSE); > } catch (IllegalArgumentException ex) { > // ignore > } > > LOG.warn("Unsupported StAX parser: " + > factory.getClass().getName() + " (Exception: " + e.toString() + ")", > e); > } > > The exception occurs in the try block and then we proceed into the catch > block, where factory = XMLInputFactory.newInstance() kicks in and works! > > Guess what StAX parser it loads? Yep: com.ctc.wstx.stax.WstxInputFactory. > Go figure. And everything works fine after that. > > > > On Sat, Nov 14, 2015 at 7:57 AM Grant Ingersoll > wrote: > >> I know I must have some conflicting libraries somewhere on my classpath, >> but I'm wondering if anyone else has seen the exception below. As you can >> see by the message, it is rather perplexing. My classpath has 2 versions >> of woodstox on it: 4.4.0 (from CMIS) and 4.4.1 from somewhere else. I am >> suspecting I have some classloader isolation issues (e.g. parent is loading >> one lib, child is loading a diff. one), but I thought I would ask to see if >> anyone else has seen it. >> >> Thanks, >> Grant >> >> 2015-11-14T07:51:26,440 - WARN [qtp1496724653-21:XMLUtils@74] - >> {collectionId=alf, datasourceId=alf} - Unsupported StAX parser: >> com.ctc.wstx.stax.WstxInputFactory (Exception: >> java.lang.ClassCastException: com.ctc.wstx.stax.WstxInputFactory cannot be >> cast to com.ctc.wstx.stax.WstxInputFactory) >> >> java.lang.ClassCastException: com.ctc.wstx.stax.WstxInputFactory cannot >> be cast to com.ctc.wstx.stax.WstxInputFactory >> >> at >> org.apache.chemistry.opencmis.commons.impl.XMLUtils.(XMLUtils.java:58) >> [chemistry-opencmis-commons-impl-0.13.0.jar:0.13.0] >> >> at >> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser.parse(AtomPubParser.java:98) >> [chemistry-opencmis-client-bindings-0.13.0.jar:0.13.0] >> >> at >> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.parse(AbstractAtomPubService.java:620) >> [chemistry-opencmis-client-bindings-0.13.0.jar:0.13.0] >> >> at >> org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getRepositoriesInternal(AbstractAtomPubService.java:809) >> [chemistry-opencmis-client-bindings-0.13.0.jar:0.13.0] >> >> at >> org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:65) >> [chemistry-opencmis-client-bindings-0.13.0.jar:0.13.0] >> >> at >> org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:90) >> [chemistry-opencmis-client-bindings-0.13.0.jar:0.13.0] >> >> at >> org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:135) >> [chemistry-opencmis-client-impl-0.13.0.jar:0.13.0] >> >> at >> org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:112) >> [chemistry-opencmis-client-impl-0.13.0.jar:0.13.0] >> > --001a11419ed29697970524803b1e--