以下是我的流式代码。我希望地图方法从外部jarfile接收我的客户方法
public void run() throws Exception {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
DataStreamSource<String> ds = env.socketTextStream("localhost",9999);
URL[] urls = {new URL("file:///Users/django/workspace/test01/target/test01-1.0.jar")};
URLClassLoader urlClassLoader = new URLClassLoader(urls);
Class say = urlClassLoader.loadClass("com.fanqizha.FanqizhaMap");
RichMapFunction parser = (RichMapFunction)say.getConstructor().newInstance();
SingleOutputStreamOperator map = ds.map(parser);
map.print();
env.execute();
}
但是我得到一个例外
org.apache.flink.streaming.runtime.tasks.StreamTaskException: Cannot load user class: com.fanqizha.FanqizhaMap
我的flink版本是1.7.1