<< Back to previous view

[DXML-32] data.xml fails when used with Java 9 Created: 27/May/16  Updated: 22/Nov/16

Status: Open
Project: data.xml
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Toby Crawley Assignee: Ryan Senior
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Java 9's module system (Jigsaw) appears to prevent loading of some of the XML classes. Java 9 isn't due to be released until March 2017, so there isn't a huge rush to fix this, but I wanted to make you aware. Unfortunately, I don't have enough knowledge of the module system to suggest the proper fix/workaround.

tcrawley@katahdin ~/w/c/data.xml> mvn test
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building data.xml 0.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ data.xml ---
[INFO] 
[INFO] --- build-helper-maven-plugin:1.5:add-source (add-clojure-source-dirs) @ data.xml ---
[INFO] Source directory: /home/tcrawley/work/clojure/data.xml/src/main/clojure added.
[INFO] 
[INFO] --- build-helper-maven-plugin:1.5:add-resource (add-clojure-source-dirs) @ data.xml ---
[INFO] 
[INFO] --- build-helper-maven-plugin:1.5:add-test-source (add-clojure-test-source-dirs) @ data.xml ---
[INFO] Test Source directory: /home/tcrawley/work/clojure/data.xml/src/test/clojure added.
[INFO] 
[INFO] --- build-helper-maven-plugin:1.5:add-test-resource (add-clojure-test-source-dirs) @ data.xml ---
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ data.xml ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/tcrawley/work/clojure/data.xml/src/main/resources
[INFO] Copying 13 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ data.xml ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- clojure-maven-plugin:1.3.13:compile (clojure-compile) @ data.xml ---
Compiling clojure.data.xml.name to /tmp/classes8428993250598039353.dir
Compiling clojure.data.xml.node to /tmp/classes8428993250598039353.dir
Compiling clojure.data.xml.jvm.name to /tmp/classes8428993250598039353.dir
Compiling clojure.data.xml.jvm.emit to /tmp/classes8428993250598039353.dir
Compiling clojure.data.xml.prxml to /tmp/classes8428993250598039353.dir
Compiling clojure.data.xml.impl to /tmp/classes8428993250598039353.dir
Compiling clojure.data.xml.tree to /tmp/classes8428993250598039353.dir
Compiling clojure.data.xml.jvm.pprint to /tmp/classes8428993250598039353.dir
Compiling clojure.data.xml.process to /tmp/classes8428993250598039353.dir
Compiling clojure.data.xml.protocols to /tmp/classes8428993250598039353.dir
Compiling clojure.data.xml.jvm.parse to /tmp/classes8428993250598039353.dir
Compiling clojure.data.xml to /tmp/classes8428993250598039353.dir
Compiling clojure.data.xml.event to /tmp/classes8428993250598039353.dir
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ data.xml ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 9 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ data.xml ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ data.xml ---
[INFO] 
[INFO] --- clojure-maven-plugin:1.3.13:test (clojure-test) @ data.xml ---
Exception in thread "main" java.lang.IllegalAccessException: class clojure.lang.Reflector cannot access class com.sun.xml.internal.stream.XMLInputFactoryImpl (in module java.xml) because module java.xml does not export com.sun.xml.internal.stream to unnamed module @1704f67f, compiling:(test_emit.clj:18)
	at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3387)
	at clojure.lang.Compiler$DefExpr.eval(Compiler.java:398)
	at clojure.lang.Compiler.eval(Compiler.java:6516)
	at clojure.lang.Compiler.load(Compiler.java:6952)
	at clojure.lang.RT.loadResourceScript(RT.java:359)
	at clojure.lang.RT.loadResourceScript(RT.java:350)
	at clojure.lang.RT.load(RT.java:429)
	at clojure.lang.RT.load(RT.java:400)
	at clojure.core$load$fn__4890.invoke(core.clj:5415)
	at clojure.core$load.doInvoke(core.clj:5414)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at clojure.core$load_one.invoke(core.clj:5227)
	at clojure.core$load_lib.doInvoke(core.clj:5264)
	at clojure.lang.RestFn.applyTo(RestFn.java:142)
	at clojure.core$apply.invoke(core.clj:603)
	at clojure.core$load_libs.doInvoke(core.clj:5298)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.core$apply.invoke(core.clj:603)
	at clojure.core$require.doInvoke(core.clj:5381)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at user$eval1038.invoke(run-test9074553612640357429.clj:5)
	at clojure.lang.Compiler.eval(Compiler.java:6511)
	at clojure.lang.Compiler.load(Compiler.java:6952)
	at clojure.lang.Compiler.loadFile(Compiler.java:6912)
	at clojure.main$load_script.invoke(main.clj:283)
	at clojure.main$script_opt.invoke(main.clj:343)
	at clojure.main$main.doInvoke(main.clj:427)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at clojure.lang.Var.invoke(Var.java:415)
	at clojure.lang.AFn.applyToHelper(AFn.java:161)
	at clojure.lang.Var.applyTo(Var.java:532)
	at clojure.main.main(main.java:37)
Caused by: java.lang.IllegalAccessException: class clojure.lang.Reflector cannot access class com.sun.xml.internal.stream.XMLInputFactoryImpl (in module java.xml) because module java.xml does not export com.sun.xml.internal.stream to unnamed module @1704f67f
	at jdk.internal.reflect.Reflection.throwIllegalAccessException(java.base@9-ea/Reflection.java:405)
	at jdk.internal.reflect.Reflection.throwIllegalAccessException(java.base@9-ea/Reflection.java:396)
	at jdk.internal.reflect.Reflection.ensureMemberAccess(java.base@9-ea/Reflection.java:98)
	at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(java.base@9-ea/AccessibleObject.java:355)
	at java.lang.reflect.AccessibleObject.checkAccess(java.base@9-ea/AccessibleObject.java:347)
	at java.lang.reflect.Method.invoke(java.base@9-ea/Method.java:525)
	at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
	at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
	at clojure.data.xml.jvm.parse$make_stream_reader.invoke(parse.clj:116)
	at clojure.data.xml$event_seq.invoke(xml.clj:57)
	at clojure.data.xml$parse.doInvoke(xml.clj:67)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at clojure.core$comp$fn__4034.invoke(core.clj:2279)
	at clojure.lang.AFn.applyToHelper(AFn.java:161)
	at clojure.lang.RestFn.applyTo(RestFn.java:132)
	at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3382)
	... 31 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.133 s
[INFO] Finished at: 2016-05-27T17:48:41-04:00
[INFO] Final Memory: 13M/300M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.theoryinpractise:clojure-maven-plugin:1.3.13:test (clojure-test) on project data.xml: Clojure failed. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
tcrawley@katahdin ~/w/c/data.xml> java -version
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+119)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+119, mixed mode)


 Comments   
Comment by Toby Crawley [ 22/Nov/16 10:02 AM ]

This is caused by http://dev.clojure.org/jira/browse/CLJ-2066

Comment by Herwig Hochleitner [ 22/Nov/16 9:38 PM ]

Unless the reflector is fixed on time for a java 9 release, we'll have to work around this in data.xml by adding appropriate annotations to avoid reflection.





Generated at Thu Dec 08 02:21:30 CST 2016 using JIRA 4.4#649-r158309.