Re: Flink QuickStart: On start up, running into ClassNotFoundException: org.apache.flink.streaming.runtime.tasks.OneInputStreamTask

Posted by Stephan Ewen on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Flink-QuickStart-On-start-up-running-into-ClassNotFoundException-org-apache-flink-streaming-runtime-k-tp4273p4276.html

Hi!

Running this is Spring, the whole classloader configuration is probably a bit different than in Flink's standalone or YARN or local mode.

Can you try if the following solves your problem: 

At the end of the file "BlobLibraryCacheManager", there is the private class "FlinkUserCodeClassloader".

Can you replace the current FlinkUserCodeClassloader with this?


private static class FlinkUserCodeClassLoader extends URLClassLoader {

public FlinkUserCodeClassLoader(URL[] urls) {
super(urls, FlinkUserCodeClassLoader.class.getClassLoader());
}
}

You can also try and use instead of "FlinkUserCodeClassLoader.class.getClassLoader()" the statements "Thread.currentThread().getContextClassLoader()".

Let me know if one of the two solves the problem.

Greetings,
Stephan


On Wed, Jan 13, 2016 at 7:20 PM, Prez Cannady <[hidden email]> wrote:
I’m experimenting combining Spring with Flink.  I’ve successfully instrumented for Gradle, but Maven is emitting ClassNotFoundExceptions for items ostensibly on the class path.

Project is currently configured for:

1. Scala 2.10.4
2. Flink 0.9.1

I execute the following

```
# In one terminal
$ nc -lk -p 9999 --sh-exec "cat /usr/share/dict/words | head -n 10”


# In another terminal
$ mvn clean install spring-boot:run -Drun.arguments=“localhost,9999”

# observe output
```

The specific class not found is org.apache.flink.streaming.runtime.tasks.OneInputStreamTask.  However, Spring Boot Plugin is configured to repackage a fat jar, and I can see that the class is present in the included flink-streaming-core jar.  Additionally, LogBack shows that the flink-streaming-core jar is in my classpath.


I’m hoping I’m just missing something that should be obvious.  While I wish could move forward with just Gradle, unfortunately I have to support Maven builds.

For reference, the complete project is available here:


Additionally

3. Gist containing the full exception (https://gist.github.com/revprez/2c1fb01c40e5d6790247)

Prez Cannady  
p: 617 500 3378