Java/数据流-无法使用ClassLoader检测类路径元素 [英] Java/Dataflow - Unable to use ClassLoader to detect classpath elements
问题描述
我猜这更多是关于Java/Eclipse的一般问题,但是我不是Java专家,这对我来说并不是很容易.最后是堆栈跟踪.
I'm guessing this is more of a general Java/Eclipse question, but I'm not a Java guy and this isn't clicking for me. Stack trace at the end.
上面是引发错误的文件,它非常简单-我们是否使用URLClassLoader
?不是Java的人,我不明白如何切换到URLClassLoader
,而使用谷歌搜索使我觉得这不是我需要关心的事情.
Above is the file where the error is being thrown and it's pretty straightforward - are we using a URLClassLoader
or not? Not being a Java guy, I don't understand how to switch to a URLClassLoader
and googling this makes me feel like it's not something I need to be concerned with.
"Unable to use ClassLoader to detect classpath elements"
让我觉得我添加了错误的类路径,而Eclipse做的事情很奇怪.
Makes me feel like I added a classpath incorrectly and Eclipse is doing something weird.
Google数据流/Apache Beam文档都没有提及URLClassLoader
的任何内容,现在我什至无法运行其示例项目.我很确定我做了什么,但是我不确定是什么.
None of the Google dataflow/apache beam documentation mention anything about a URLClassLoader
and now I can't even get their example project to run. I'm pretty sure I did something, but I'm not sure what.
任何帮助将不胜感激.
Jan 16, 2018 8:03:48 PM org.apache.beam.runners.dataflow.DataflowRunner
detectClassPathResourcesToStage
SEVERE: Unable to use ClassLoader to detect classpath elements. Current ClassLoader is jdk.internal.loader.ClassLoaders$AppClassLoader@3b764bce, only URLClassLoaders are supported.
Exception in thread "main" java.lang.RuntimeException: Failed to construct instance from factory method DataflowRunner#fromOptions(interface org.apache.beam.sdk.options.PipelineOptions)
at org.apache.beam.sdk.util.InstanceBuilder.buildFromMethod(InstanceBuilder.java:233)
at org.apache.beam.sdk.util.InstanceBuilder.build(InstanceBuilder.java:162)
at org.apache.beam.sdk.PipelineRunner.fromOptions(PipelineRunner.java:52)
at org.apache.beam.sdk.Pipeline.create(Pipeline.java:142)
at twitchInsights.MainPipeline.main(MainPipeline.java:59)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.beam.sdk.util.InstanceBuilder.buildFromMethod(InstanceBuilder.java:222)
... 4 more
Caused by: java.lang.IllegalArgumentException: Unable to use ClassLoader to detect classpath elements. Current ClassLoader is jdk.internal.loader.ClassLoaders$AppClassLoader@3b764bce, only URLClassLoaders are supported.
at org.apache.beam.runners.dataflow.DataflowRunner.detectClassPathResourcesToStage(DataflowRunner.java:1365)
at org.apache.beam.runners.dataflow.DataflowRunner.fromOptions(DataflowRunner.java:244)
... 9 more
完全例外:
Thread [main] (Suspended (exception IllegalArgumentException))
DataflowRunner.detectClassPathResourcesToStage(ClassLoader) line: 1365
DataflowRunner.fromOptions(PipelineOptions) line: 244
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 62
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 564
InstanceBuilder<T>.buildFromMethod(Class<?>[]) line: 222
InstanceBuilder<T>.build() line: 162
PipelineRunner<ResultT>.fromOptions(PipelineOptions) line: 52
Pipeline.create(PipelineOptions) line: 142
MainPipeline.main(String[]) line: 60
推荐答案
我认为这是Java 9特有的问题. Beam尚未正式支持Java 9-请参见 https://issues.apache.org/jira /browse/BEAM-2530 了解当前进度.
I think this is a Java 9 specific issue. Beam does not officially support Java 9 yet - see https://issues.apache.org/jira/browse/BEAM-2530 for current progress.
您可以尝试通过通过--filesToStage
指定classpath元素来解决此特定问题(这将绕过基于当前classloader的自动检测-这是失败的).但是,您可能会遇到其他问题.
You can try working around this specific issue by specifying the classpath elements via --filesToStage
instead (this will bypass the autodetection based on current classloader - which is what's failing). However you may hit other issues.
这篇关于Java/数据流-无法使用ClassLoader检测类路径元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!