Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoClassDefFoundError #32

Open
chenwentest opened this issue Mar 2, 2023 · 2 comments
Open

java.lang.NoClassDefFoundError #32

chenwentest opened this issue Mar 2, 2023 · 2 comments

Comments

@chenwentest
Copy link

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
Copy link

galeka commented Aug 18, 2024

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants