flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Flavio Pompermaier <pomperma...@okkam.it>
Subject Re: ClasNotFound when submitting job from command line
Date Tue, 19 Apr 2016 16:13:12 GMT
I use maven to generate the shaded jar (and the classes are inside it) but
when the job starts it can load those classes using Class.forName()
(required to instantiate the JDBC connections).
I think it's probably a problem related to class loading of Flink

On Tue, Apr 19, 2016 at 6:02 PM, Balaji Rajagopalan <
balaji.rajagopalan@olacabs.com> wrote:

> In your pom.xml add the maven.plugins like this, and you will have to add
> all the dependent artifacts, this works for me, if you fire mvn clean
> compile package, the created jar is a fat jar.
>
> <plugin>
>
>                 <groupId>org.apache.maven.plugins</groupId>
>
>                 <artifactId>maven-dependency-plugin</artifactId>
>
>                 <version>2.9</version>
>
>                 <executions>
>
>                     <execution>
>
>                         <id>unpack</id>
>
>                         <!-- executed just before the package phase -->
>
>                         <phase>prepare-package</phase>
>
>                         <goals>
>
>                             <goal>unpack</goal>
>
>                         </goals>
>
>                         <configuration>
>
>                             <artifactItems>
>
>                                 <!-- For Flink connector classes -->
>
>                                 <artifactItem>
>
>                                     <groupId>org.apache.flink</groupId>
>
>
> <artifactId>flink-connector-kafka-0.8_${scala.version}</artifactId>
>
>                                     <version>${flink.version}</version>
>
>                                     <type>jar</type>
>
>                                     <overWrite>false</overWrite>
>
>
> <outputDirectory>${project.build.directory}/classes</outputDirectory>
>
>
> <includes>org/apache/flink/**</includes>
>
>                                 </artifactItem>
>
>        ...
>
>       ...
>
>                         </artifactItems>
>
>                         </configuration>
>
>                     </execution>
>
>                 </executions>
>
>             </plugin>
>
> On Tue, Apr 19, 2016 at 9:10 PM, Flavio Pompermaier <pompermaier@okkam.it>
> wrote:
>
>> Hi to all,
>>
>> I just tied to dubmit my application to the Flink cluster (1.0.1) but I
>> get ClassNotFound exceptions for classes inside my shaded jar (like
>> oracle.jdbc.OracleDriver or org.apache.commons.pool2.PooledObjectFactory).
>> Those classes are in the shaded jar but aren't found.
>> If I put the jars in the flink's lib dir (for every node of the cluster)
>> things work.
>> How can I solve that?
>>
>> Best,
>> Flavio
>>
>
>

Mime
View raw message