How To Solve No Class Def Found Error Could Not Initialize Class Org Apache IgniteJdbcThinDriver
這篇介紹How To Solve No Class Def Found Error Could Not Initialize Class Org Apache IgniteJdbcThinDriver。
process
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| 在升級Jdk8 -> Jdk17時,Maven build時會出現 java.lang.NoClassDefFoundError: Could not initialize class org.apache.ignite.IgniteJdbcThinDriver 錯誤訊息
原因是Apache Ignite 2.7.0建議使用 Java 8,不完全支持 Java 12以上。需調整設定才能正常運作
解決方法:增加<argLine>--add-opens java.base/java.nio=ALL-UNNAMED</argLine>
plugin如下:
<!-- maven unit test plug-in --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0</version> <configuration> <!-- 限制測試爲單一執行序,一個一個單元進行測試 --> <forkCount>1</forkCount> <reuseForks>false</reuseForks> <!-- 共要設定2項 --> <argLine>-Xmx2G</argLine> <argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine> <argLine>--add-opens java.base/java.nio=ALL-UNNAMED</argLine> </configuration> </plugin>
|