[
https://issues.apache.org/jira/browse/TEZ-3860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16221232#comment-16221232
]
Jonathan Eagles commented on TEZ-3860:
--------------------------------------
This might be a little more difficult than initially thought.
from
https://blog.codefx.org/java/java-9-migration-guide/#Casting-To-URL-Class-Loader
{quote}
The class loader was probably cast to access methods specific to
URLClassLoader. If so, your chances to do a migration with only small changes
are slim. The only supported (and hence accessible) super types of the new
AppClassLoader are SecureClassLoader and ClassLoader and only few methods were
added here in 9. Still, have a look, they might do what you’re looking for.
If you’ve used the URLClassLoader to dynamically load user provided code (for
example as part of a plugin infrastructure) by appending to the class path,
then you have to find a new way to do that as it can not be done with Java 9.
You should instead consider creating a new class loader for that. This has the
added advantage that you’ll be able to get rid of the new classes as they are
not loaded into the application class loader. If you’re compiling against Java
9, you should read up on layers – they give you a clean abstraction for loading
an entirely new module graph.
{quote}
> JDK9: ReflectionUtils may not use URLClassLoader
> ------------------------------------------------
>
> Key: TEZ-3860
> URL: https://issues.apache.org/jira/browse/TEZ-3860
> Project: Apache Tez
> Issue Type: Sub-task
> Reporter: Zoltan Haindrich
>
> The following code
> https://github.com/apache/tez/blob/master/tez-api/src/main/java/org/apache/tez/common/ReflectionUtils.java#L125
> is not compatible with JDK9 since the classloader is an AppClassLoader
> causes exceptions like this:
> {code}
> java.lang.ClassCastException:
> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to
> java.base/java.net.URLClassLoader
> at
> org.apache.tez.common.ReflectionUtils.addResourcesToSystemClassLoader(ReflectionUtils.java:125)
> ~[tez-api-0.9.0.jar:0.9.0]
> at
> org.apache.tez.dag.utils.RelocalizationUtils.addUrlsToClassPath(RelocalizationUtils.java:57)
> ~[tez-common-0.9.0.jar:0.9.0]
> at
> org.apache.tez.dag.app.dag.impl.DAGImpl$StartTransition.transition(DAGImpl.java:1793)
> ~[tez-dag-0.9.0.jar:0.9.0]
> at
> org.apache.tez.dag.app.dag.impl.DAGImpl$StartTransition.transition(DAGImpl.java:1776)
> ~[tez-dag-0.9.0.jar:0.9.0]
> at
> org.apache.hadoop.yarn.state.StateMachineFactory$SingleInternalArc.doTransition(StateMachineFactory.java:362)
> ~[hadoop-yarn-common-2.8.1.jar:?]
> at
> org.apache.hadoop.yarn.state.StateMachineFactory.doTransition(StateMachineFactory.java:302)
> ~[hadoop-yarn-common-2.8.1.jar:?]
> at
> org.apache.hadoop.yarn.state.StateMachineFactory.access$300(StateMachineFactory.java:46)
> ~[hadoop-yarn-common-2.8.1.jar:?]
> at
> org.apache.hadoop.yarn.state.StateMachineFactory$InternalStateMachine.doTransition(StateMachineFactory.java:448)
> ~[hadoop-yarn-common-2.8.1.jar:?]
> at
> org.apache.tez.state.StateMachineTez.doTransition(StateMachineTez.java:59)
> ~[tez-dag-0.9.0.jar:0.9.0]
> at org.apache.tez.dag.app.dag.impl.DAGImpl.handle(DAGImpl.java:1156)
> [tez-dag-0.9.0.jar:0.9.0]
> at org.apache.tez.dag.app.dag.impl.DAGImpl.handle(DAGImpl.java:147)
> [tez-dag-0.9.0.jar:0.9.0]
> at
> org.apache.tez.dag.app.DAGAppMaster$DagEventDispatcher.handle(DAGAppMaster.java:2251)
> [tez-dag-0.9.0.jar:0.9.0]
> at
> org.apache.tez.dag.app.DAGAppMaster$DagEventDispatcher.handle(DAGAppMaster.java:2242)
> [tez-dag-0.9.0.jar:0.9.0]
> at
> org.apache.tez.common.AsyncDispatcher.dispatch(AsyncDispatcher.java:180)
> [tez-common-0.9.0.jar:0.9.0]
> at
> org.apache.tez.common.AsyncDispatcher$1.run(AsyncDispatcher.java:115)
> [tez-common-0.9.0.jar:0.9.0]
> at java.base/java.lang.Thread.run(Thread.java:844) [?:?]
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)