You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Mark Raynsford <li...@io7m.com> on 2017/12/05 21:18:39 UTC

Xerces-J 2.* On JDK 9

Hello.

Is it possible to use Xerces in a (modular) JDK 9 project?

I'm trying to do SAX parsing with XSD schema validation, and in order
to resolve schema locations, I need to be able to set a resolver. I
can't do this using the JDK's included SAXParser as it appears to
conform to an older interface (1.4?) which doesn't provide a way to set
a resolver.

If I attempt to use Xerces-J 2.11.0, however, I get a ton of
compilation errors because packages in Xerces conflict with those in
the JDK:

Error:java: the unnamed module reads package org.w3c.dom.html from both xercesImpl and xml.apis
Error:java: the unnamed module reads package javax.xml.datatype from both xml.apis and java.xml
Error:java: the unnamed module reads package javax.xml.transform.dom from both xml.apis and java.xml
Error:java: the unnamed module reads package org.w3c.dom.ranges from both xml.apis and java.xml
Error:java: the unnamed module reads package javax.xml.transform from both xml.apis and java.xml
Error:java: the unnamed module reads package org.xml.sax.ext from both xml.apis and java.xml
Error:java: the unnamed module reads package javax.xml.namespace from both xml.apis and java.xml
Error:java: the unnamed module reads package javax.xml from both xml.apis and java.xml
Error:java: the unnamed module reads package org.w3c.dom.ls from both xml.apis and java.xml
Error:java: the unnamed module reads package org.xml.sax.helpers from both xml.apis and java.xml
Error:java: the unnamed module reads package javax.xml.validation from both xml.apis and java.xml
Error:java: the unnamed module reads package org.w3c.dom from both xml.apis and java.xml
Error:java: the unnamed module reads package javax.xml.transform.stax from both xml.apis and java.xml
Error:java: the unnamed module reads package org.w3c.dom.bootstrap from both xml.apis and java.xml
Error:java: the unnamed module reads package javax.xml.parsers from both xml.apis and java.xml
Error:java: the unnamed module reads package javax.xml.stream.events from both xml.apis and java.xml
Error:java: the unnamed module reads package org.w3c.dom.views from both xml.apis and java.xml
Error:java: the unnamed module reads package javax.xml.xpath from both xml.apis and java.xml
Error:java: the unnamed module reads package org.xml.sax from both xml.apis and java.xml
Error:java: the unnamed module reads package org.w3c.dom.events from both xml.apis and java.xml
Error:java: the unnamed module reads package javax.xml.transform.sax from both xml.apis and java.xml
Error:java: the unnamed module reads package javax.xml.stream from both xml.apis and java.xml
Error:java: the unnamed module reads package javax.xml.stream.util from both xml.apis and java.xml
Error:java: the unnamed module reads package org.w3c.dom.traversal from both xml.apis and java.xml
Error:java: the unnamed module reads package javax.xml.transform.stream from both xml.apis and java.xml

Is there any timeline for getting this working (if it's happening at
all)?

-- 
Mark Raynsford | http://www.io7m.com


Re: Xerces-J 2.* On JDK 9

Posted by Mark Raynsford <li...@io7m.com>.
On 2017-12-05T16:28:41 -0800
Jeff Greif <jg...@alumni.princeton.edu> wrote:

> You put the xerces jars in the "endorsed overrides" directory.
> 
> https://docs.oracle.com/javase/8/docs/technotes/guides/standards/

"This feature is deprecated and will be removed in a future release."

It has actually been removed entirely in JDK 9.

A possible workaround for this would be to run the Xerces jar through
something like Maven Shade to bulk relocate all of the classes into
another package.

  https://maven.apache.org/plugins/maven-shade-plugin/

I may end up having to do this if Xerces isn't going to change in this
regard any time soon.

-- 
Mark Raynsford | http://www.io7m.com


Re: Xerces-J 2.* On JDK 9

Posted by Mukul Gandhi <mu...@apache.org>.
On Tue, Jan 2, 2018 at 10:30 PM, Michael Glavassevich <mr...@ca.ibm.com>
wrote:

> I can imagine there would be an issue with xml-apis.jar (and Java 9
> modularization), but nothing in xercesImpl.jar should conflict with classes
> in JDK 9. You should be able to include the implementation jar on the
> regular classpath.


 I just tried running Xerces on Java 9 (without Java 9 modularization, but
putting all Xerces Jars on Java 9 classpath). It works.

Here's a simple windows .bat file that works fine,

@echo off
set JAVA_HOME="C:\Program Files\Java\jdk-9.0.4"
set
BUILD_DIR=E:\eclipseWorkspace\xercesj\xerces-java-xml-schema-1.1-dev\build
set
CP=%BUILD_DIR%\cupv10k-runtime.jar;%BUILD_DIR%\icu4j.jar;%BUILD_DIR%\org.eclipse.wst.xml.xpath2.processor_1.2.0.jar;%BUILD_DIR%\resolver.jar;%BUILD_DIR%\serializer.jar;%BUILD_DIR%\xercesImpl.jar;%BUILD_DIR%\xercesSamples.jar;%BUILD_DIR%\xml-apis.jar
%JAVA_HOME%\bin\java -classpath %CP% jaxp.SourceValidator -i %1 -a %2 -f
-xsd11

Therefore I can claim,
XercesJ XSD 1.1 runs fine on Java 1.4.x upto Java 9,
&
XercesJ on trunk runs fine on Java 1.3.x upto Java 9.




-- 
Regards,
Mukul Gandhi

Re: Xerces-J 2.* On JDK 9

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
I can imagine there would be an issue with xml-apis.jar (and Java 9 
modularization), but nothing in xercesImpl.jar should conflict with 
classes in JDK 9. You should be able to include the implementation jar on 
the regular classpath.

Thanks.

Michael Glavassevich
XML Technologies and WAS Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Mark Raynsford <li...@io7m.com> wrote on 12/06/2017 
11:40:13 AM:

> On 2017-12-05T16:28:41 -0800
> Jeff Greif <jg...@alumni.princeton.edu> wrote:
> 
> > You put the xerces jars in the "endorsed overrides" directory.
> > 
> > https://docs.oracle.com/javase/8/docs/technotes/guides/standards/
> 
> "This feature is deprecated and will be removed in a future release."
> 
> It has actually been removed entirely in JDK 9.
> 
> A possible workaround for this would be to run the Xerces jar through
> something like Maven Shade to bulk relocate all of the classes into
> another package.
> 
>   https://maven.apache.org/plugins/maven-shade-plugin/
> 
> I may end up having to do this if Xerces isn't going to change in this
> regard any time soon.
> 
> -- 
> Mark Raynsford | http://www.io7m.com


Re: Xerces-J 2.* On JDK 9

Posted by Jeff Greif <jg...@alumni.princeton.edu>.
You put the xerces jars in the "endorsed overrides" directory.

https://docs.oracle.com/javase/8/docs/technotes/guides/standards/

On Tue, Dec 5, 2017 at 1:18 PM, Mark Raynsford <
list+org.apache.xerces@io7m.com> wrote:

> Hello.
>
> Is it possible to use Xerces in a (modular) JDK 9 project?
>
> I'm trying to do SAX parsing with XSD schema validation, and in order
> to resolve schema locations, I need to be able to set a resolver. I
> can't do this using the JDK's included SAXParser as it appears to
> conform to an older interface (1.4?) which doesn't provide a way to set
> a resolver.
>
> If I attempt to use Xerces-J 2.11.0, however, I get a ton of
> compilation errors because packages in Xerces conflict with those in
> the JDK:
>
> Error:java: the unnamed module reads package org.w3c.dom.html from both
> xercesImpl and xml.apis
> Error:java: the unnamed module reads package javax.xml.datatype from both
> xml.apis and java.xml
> Error:java: the unnamed module reads package javax.xml.transform.dom from
> both xml.apis and java.xml
> Error:java: the unnamed module reads package org.w3c.dom.ranges from both
> xml.apis and java.xml
> Error:java: the unnamed module reads package javax.xml.transform from both
> xml.apis and java.xml
> Error:java: the unnamed module reads package org.xml.sax.ext from both
> xml.apis and java.xml
> Error:java: the unnamed module reads package javax.xml.namespace from both
> xml.apis and java.xml
> Error:java: the unnamed module reads package javax.xml from both xml.apis
> and java.xml
> Error:java: the unnamed module reads package org.w3c.dom.ls from both
> xml.apis and java.xml
> Error:java: the unnamed module reads package org.xml.sax.helpers from both
> xml.apis and java.xml
> Error:java: the unnamed module reads package javax.xml.validation from
> both xml.apis and java.xml
> Error:java: the unnamed module reads package org.w3c.dom from both
> xml.apis and java.xml
> Error:java: the unnamed module reads package javax.xml.transform.stax from
> both xml.apis and java.xml
> Error:java: the unnamed module reads package org.w3c.dom.bootstrap from
> both xml.apis and java.xml
> Error:java: the unnamed module reads package javax.xml.parsers from both
> xml.apis and java.xml
> Error:java: the unnamed module reads package javax.xml.stream.events from
> both xml.apis and java.xml
> Error:java: the unnamed module reads package org.w3c.dom.views from both
> xml.apis and java.xml
> Error:java: the unnamed module reads package javax.xml.xpath from both
> xml.apis and java.xml
> Error:java: the unnamed module reads package org.xml.sax from both
> xml.apis and java.xml
> Error:java: the unnamed module reads package org.w3c.dom.events from both
> xml.apis and java.xml
> Error:java: the unnamed module reads package javax.xml.transform.sax from
> both xml.apis and java.xml
> Error:java: the unnamed module reads package javax.xml.stream from both
> xml.apis and java.xml
> Error:java: the unnamed module reads package javax.xml.stream.util from
> both xml.apis and java.xml
> Error:java: the unnamed module reads package org.w3c.dom.traversal from
> both xml.apis and java.xml
> Error:java: the unnamed module reads package javax.xml.transform.stream
> from both xml.apis and java.xml
>
> Is there any timeline for getting this working (if it's happening at
> all)?
>
> --
> Mark Raynsford | http://www.io7m.com
>
>