[ 
https://issues.apache.org/jira/browse/FLINK-30031?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jingsong Lee closed FLINK-30031.
--------------------------------
    Resolution: Fixed

> flink table store run abnormally when shade flink
> -------------------------------------------------
>
>                 Key: FLINK-30031
>                 URL: https://issues.apache.org/jira/browse/FLINK-30031
>             Project: Flink
>          Issue Type: Bug
>          Components: Table Store
>    Affects Versions: 1.15.0, table-store-0.2.1
>            Reporter: zhenzhenhua
>            Priority: Major
>
> {color:#172b4d}I try to sink flink-table-store in Apache SeaTunnel, SeaTunnel 
> use the Flink version is 13.6.{color}
> {color:#172b4d}To avoid flink conflict,I use maven-shade-plugin plugin to 
> shade flink dependency.{color}
> {color:#172b4d}However, runing build jar to write  flink-table-store occur 
> error,throw exception:{color}
>  
> {code:java}
> Exception in thread "main" java.lang.NoClassDefFoundError: 
> org/apache/flink/table/store/codegen/CodeGenerator
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
>         at 
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
>         at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
>         at 
> org.apache.flink.table.store.codegen.ComponentClassLoader.loadClassFromComponentOnly(ComponentClassLoader.java:127)
>         at 
> org.apache.flink.table.store.codegen.ComponentClassLoader.loadClass(ComponentClassLoader.java:106)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:348)
>         at 
> java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370)
>         at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
>         at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
>         at java.util.Iterator.forEachRemaining(Iterator.java:116)
>         at 
> org.apache.flink.table.store.codegen.CodeGenLoader.discover(CodeGenLoader.java:123)
>         at 
> org.apache.flink.table.store.codegen.CodeGenUtils.generateRecordComparator(CodeGenUtils.java:65)
>         at 
> org.apache.flink.table.store.file.utils.KeyComparatorSupplier.<init>(KeyComparatorSupplier.java:40)
>         at 
> org.apache.flink.table.store.file.KeyValueFileStore.<init>(KeyValueFileStore.java:59)
>         at 
> org.apache.flink.table.store.table.ChangelogWithKeyFileStoreTable.<init>(ChangelogWithKeyFileStoreTable.java:103)
>         at 
> org.apache.flink.table.store.table.FileStoreTableFactory.create(FileStoreTableFactory.java:72)
>         at 
> org.apache.flink.table.store.table.FileStoreTableFactory.create(FileStoreTableFactory.java:50)
>         at org.example.TestWrite.main(TestWrite.java:24)
> Caused by: java.lang.ClassNotFoundException: 
> org.apache.flink.table.store.codegen.CodeGenerator
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
>         at 
> org.apache.flink.table.store.codegen.ComponentClassLoader.loadClassFromComponentOnly(ComponentClassLoader.java:127)
>         at 
> org.apache.flink.table.store.codegen.ComponentClassLoader.loadClass(ComponentClassLoader.java:106)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
>         ... 27 more
>  {code}
>  
>  
> {code:java}
> // pom.xml
> <dependencies>
>     <dependency>
>         <groupId>org.apache.flink</groupId>
>         <artifactId>flink-table-store-core</artifactId>
>         <version>0.2.1</version>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.flink</groupId>
>         <artifactId>flink-table-store-format</artifactId>
>         <version>0.2.1</version>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.flink</groupId>
>         <artifactId>flink-table-common</artifactId>
>         <version>1.15.0</version>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.flink</groupId>
>         <artifactId>flink-table-runtime</artifactId>
>         <version>1.15.0</version>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.flink</groupId>
>         <artifactId>flink-connector-base</artifactId>
>         <version>1.15.0</version>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.flink</groupId>
>         <artifactId>flink-shaded-jackson</artifactId>
>         <version>2.12.1-13.0</version>
>     </dependency>
>      <dependency>
>         <groupId>org.apache.flink</groupId>
>         <artifactId>flink-shaded-hadoop-2-uber</artifactId>
>         <version>2.7.5-10.0</version>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.commons</groupId>
>         <artifactId>commons-lang3</artifactId>
>         <version>3.3.2</version>
>     </dependency>
>     <dependency>
>         <groupId>log4j</groupId>
>         <artifactId>log4j</artifactId>
>         <version>1.2.17</version>
>     </dependency>
> </dependencies>
> <build>
>     <plugins>
>         <plugin>
>             <groupId>org.apache.maven.plugins</groupId>
>             <artifactId>maven-shade-plugin</artifactId>
>             <version>3.1.1</version>
>             <configuration>
>                 <!-- no create dependency-reduced-pom.xml-->
>                 <createDependencyReducedPom>false</createDependencyReducedPom>
>             </configuration>
>             <executions>
>                 <!-- Run shade goal on package phase -->
>                 <execution>
>                     <phase>package</phase>
>                     <goals>
>                         <goal>shade</goal>
>                     </goals>
>                     <configuration>
>                         <relocations>
>                             <relocation>
>                                 <pattern>org.apache.flink</pattern>
>                                 
> <shadedPattern>shade.org.apache.flink</shadedPattern>
>                                 <excludes>
>                                     
> <exclude>org.apache.flink.table.store.**</exclude>
>                                 </excludes>
>                             </relocation>
>                         </relocations>
>                     </configuration>
>                 </execution>
>             </executions>
>         </plugin>
>     </plugins>
> </build>{code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to