aliyun / aliyun-odps-console

ODPS Console Source Code.
http://www.aliyun.com/product/odps
93 stars 26 forks source link

java.lang.NoClassDefFoundError #32

Open chenwentest opened 1 year ago

chenwentest commented 1 year ago

Exception in thread "main" java.lang.NoClassDefFoundError: com/aliyun/odps/compiler/parser/OdpsLexer at com.aliyun.odps.sqa.commandapi.utils.SqlParserUtil.getSqlParserListener(SqlParserUtil.java:208) at com.aliyun.odps.sqa.commandapi.utils.SqlParserUtil.isSelect(SqlParserUtil.java:175) at com.aliyun.odps.sqa.SQLExecutorImpl.isSelect(SQLExecutorImpl.java:1347) at com.aliyun.odps.sqa.SQLExecutorImpl.getResultSetInternal(SQLExecutorImpl.java:1013) at com.aliyun.odps.sqa.SQLExecutorImpl.getResultSet(SQLExecutorImpl.java:667) at com.aliyun.openservices.odps.console.InteractiveQueryCommand.getQueryResult(InteractiveQueryCommand.java:305) at com.aliyun.openservices.odps.console.InteractiveQueryCommand.submitSubQuery(InteractiveQueryCommand.java:370) at com.aliyun.openservices.odps.console.InteractiveQueryCommand.run(InteractiveQueryCommand.java:694) at com.aliyun.openservices.odps.console.commands.AbstractCommand.execute(AbstractCommand.java:116) at com.aliyun.openservices.odps.console.commands.InteractiveCommand.run(InteractiveCommand.java:108) at com.aliyun.openservices.odps.console.commands.AbstractCommand.execute(AbstractCommand.java:116) at com.aliyun.openservices.odps.console.commands.CompositeCommand.run(CompositeCommand.java:48) at com.aliyun.openservices.odps.console.commands.AbstractCommand.execute(AbstractCommand.java:116) at com.aliyun.openservices.odps.console.ODPSConsole.main(ODPSConsole.java:63) Caused by: java.lang.ClassNotFoundException: com.aliyun.odps.compiler.parser.OdpsLexer at java.net.URLClassLoader.findClass(URLClassLoader.java:387) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ... 14 more

galeka commented 1 month ago

My java version % java -version
openjdk version "21.0.2" 2024-01-16 LTS OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode)

I got same error when run "mvn clean test"

image

[ERROR] Errors: [ERROR] InstanceRunnerTest.:67 » NoClassDefFound Could not initialize class org.mockito.internal.creation.jmock.ClassImposterizer$3 [ERROR] InstanceRunnerTest.testPollingOutput » NoClassDefFound Could not initialize class com.aliyun.openservices.odps.console.InstanceRunnerTest [ERROR] InstanceRunnerTest.testSubmitRetry_failed » NoClassDefFound Could not initialize class com.aliyun.openservices.odps.console.InstanceRunnerTest [ERROR] InstanceRunnerTest.testSubmitRetry_listFailed » NoClassDefFound Could not initialize class com.aliyun.openservices.odps.console.InstanceRunnerTest [ERROR] InstanceRunnerTest.testSubmitRetry_listSuccess » NoClassDefFound Could not initialize class com.aliyun.openservices.odps.console.InstanceRunnerTest [ERROR] InstanceRunningTest.testInstanceRunning_GetProgressFail » NoClassDefFound Could not initialize class com.aliyun.openservices.odps.console.output.state.InstanceRunningTest [ERROR] InstanceRunningTest.:39 » ExceptionInInitializer [ERROR] ODPSConsoleUtilsTest.getConfigNull:50 ClassCast class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap') [INFO] [ERROR] Tests run: 51, Failures: 0, Errors: 8, Skipped: 0

dingxin-tech commented 1 month ago

My java version % java -version openjdk version "21.0.2" 2024-01-16 LTS OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode)

I got same error when run "mvn clean test" image [ERROR] Errors: [ERROR] InstanceRunnerTest.:67 » NoClassDefFound Could not initialize class org.mockito.internal.creation.jmock.ClassImposterizer$3 [ERROR] InstanceRunnerTest.testPollingOutput » NoClassDefFound Could not initialize class com.aliyun.openservices.odps.console.InstanceRunnerTest [ERROR] InstanceRunnerTest.testSubmitRetry_failed » NoClassDefFound Could not initialize class com.aliyun.openservices.odps.console.InstanceRunnerTest [ERROR] InstanceRunnerTest.testSubmitRetry_listFailed » NoClassDefFound Could not initialize class com.aliyun.openservices.odps.console.InstanceRunnerTest [ERROR] InstanceRunnerTest.testSubmitRetry_listSuccess » NoClassDefFound Could not initialize class com.aliyun.openservices.odps.console.InstanceRunnerTest [ERROR] InstanceRunningTest.testInstanceRunning_GetProgressFail » NoClassDefFound Could not initialize class com.aliyun.openservices.odps.console.output.state.InstanceRunningTest [ERROR] InstanceRunningTest.:39 » ExceptionInInitializer [ERROR] ODPSConsoleUtilsTest.getConfigNull:50 ClassCast class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap') [INFO] [ERROR] Tests run: 51, Failures: 0, Errors: 8, Skipped: 0

Hi @galeka,

The error you are seeing (java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader) is due to the changes in Java 9 where application and extension classes are no longer instances of java.net.URLClassLoader. This causes issues when using reflection operations.

Specifically, the problem arises from using Mockito v1, which is not compatible with JDK versions higher than Java 8. Unfortunately, our test suite is currently built on JDK 8. We will work on adapting and upgrading our test suite to accommodate higher JDK versions in the future.

Thank you for bringing this to our attention and we apologize for any inconvenience this has caused. If you have any further questions or concerns, please feel free to reach out.

Best, @dingxin-tech