[ 
https://issues.apache.org/jira/browse/FLINK-5690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15865794#comment-15865794
 ] 

ASF GitHub Bot commented on FLINK-5690:
---------------------------------------

Github user alpinegizmo commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3300#discussion_r101038332
  
    --- Diff: docs/dev/best_practices.md ---
    @@ -310,3 +310,17 @@ Next, you need to put the following jar files into the 
`lib/` folder:
     Note that you need to explicitly set the `lib/` directory when using a per 
job YARN cluster.
     
     The command to submit Flink on YARN with a custom logger is: `./bin/flink 
run -yt $FLINK_HOME/lib <... remaining arguments ...>`
    +
    +
    +## Resolving Dependency Conflicts with Flink using the maven-shade-plugin.
    +
    +Apache Flink loads many classes by default into its classpath (the 
[classloading is described here in 
detail]({{site.baseurl}}/monitoring/debugging_classloading.html)). If a user 
uses a different version of a library that Flink is using, often 
`IllegalAccessExceptions` or `NoSuchMethodError` are the result.
    +
    +Through Hadoop, Flink for example depends on the `aws-sdk` library or on 
`protobuf-java`. If your user code is using these libraries and you run into 
issues we recommend relocating the dependency in your user code jar.
    +
    +Apache Maven offers the 
[maven-shade-plugin](https://maven.apache.org/plugins/maven-shade-plugin/), 
that allows to change the package of a class *after* compiling it (so the code 
you are writing is not affected by the shading). For example if you have the 
`com.amazonaws` packages from the aws sdk in your user code jar, the shade 
plugin would relocate them into the `org.myorg.shaded.com.amazonaws` package, 
so that your code is calling your aws sdk version.
    --- End diff --
    
    I suggest a minor rewording:
    
    Apache Maven offers the 
[maven-shade-plugin](https://maven.apache.org/plugins/maven-shade-plugin/), 
which allows one to change the package of a class *after* compiling it ...


> protobuf is not shaded properly
> -------------------------------
>
>                 Key: FLINK-5690
>                 URL: https://issues.apache.org/jira/browse/FLINK-5690
>             Project: Flink
>          Issue Type: Bug
>          Components: Build System
>    Affects Versions: 1.1.4, 1.3.0
>            Reporter: Andrey
>            Assignee: Robert Metzger
>
> Currently distributive contains com/google/protobuf package. Without proper 
> shading client code could fail with:
> {code}
> Caused by: java.lang.IllegalAccessError: tried to access method 
> com.google.protobuf.XXXX
> {code}
> Steps to reproduce:
> * create job class "com.google.protobuf.TestClass"
> * call com.google.protobuf.TextFormat.escapeText(String) method from this 
> class
> * deploy job to flink cluster (usign web console for example)
> * run job. In logs IllegalAccessError.
> Issue in package protected method and different classloaders. TestClass 
> loaded by FlinkUserCodeClassLoader, but TextFormat class loaded by 
> sun.misc.Launcher$AppClassLoader



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to