如何修复线程“main”中的异常java.lang.NoClassDefFoundError:javax / xml / bind / DatatypeConverter

时间:2018-04-06 00:29:00

标签: java

我看到了一些关于它的线索,但它并没有真正帮助我......

我有java JDK 10.在Windows 10 64位上运行。我试图使用的是机器人。关于它的github链接是here

这是我正在执行的脚本的日志

C:\Users\administrator\Downloads\vHackOSBot>java -jar vHackOSBot.jar
20:15:09 INFO [UpdateService] Creating UpdateService...
20:15:09 INFO [MiscService] Creating MiscService...
20:15:09 INFO [NetworkingService] Creating NetworkingService...
20:15:09 INFO [MainService] Creating MainService...
20:15:09 INFO [ServerService] Creating ServerService...
20:15:09 INFO [vHackOSBot-Config] Creating ConfigFile...
20:15:09 INFO [vHackOSBot-ConfigAdv] Creating ConfigFile...
20:15:09 WARN [io.sentry.DefaultSentryClientFactory] No 'stacktrace.app.packages' was configured, this option is highly recommended as it affects stacktrace grouping and display on Sentry. See documentation: https://docs.sentry.io/clients/java/config/#in-application-stack-frames
20:15:09 WARN [io.sentry.DefaultSentryClientFactory] No 'stacktrace.app.packages' was configured, this option is highly recommended as it affects stacktrace grouping and display on Sentry. See documentation: https://docs.sentry.io/clients/java/config/#in-application-stack-frames
20:15:10 INFO [vHackOSBot-ConfigAdv] Loading advanced config...
20:15:10 INFO [vHackOSBot-ConfigAdv] Loaded advanced config in 223ms.
20:15:10 INFO [vHackOSBot-ConfigAdv] Saving advanced config...
20:15:10 INFO [vHackOSBot-ConfigAdv] Saved advanced config in 29ms.
20:15:10 INFO [vHackOSBot-Config] Loading config...
20:15:10 INFO [vHackOSBot-Config] Loaded config in 47ms.
20:15:10 INFO [vHackOSBot-Config] Saving config...
20:15:10 INFO [vHackOSBot-Config] Saved config in 2ms.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
        at net.olympiccode.vhackos.api.utils.Encryption.md5Hash(Encryption.java:15)
        at net.olympiccode.vhackos.api.requests.Route.compile(Route.java:59)
        at net.olympiccode.vhackos.api.entities.impl.vHackOSAPIImpl.verifyDetails(vHackOSAPIImpl.java:108)
        at net.olympiccode.vhackos.api.entities.impl.vHackOSAPIImpl.login(vHackOSAPIImpl.java:83)
        at net.olympiccode.vhackos.api.vHackOSAPIBuilder.buildAsync(vHackOSAPIBuilder.java:92)
        at net.olympiccode.vhackos.api.vHackOSAPIBuilder.buildBlocking(vHackOSAPIBuilder.java:104)
        at net.olympiccode.vhackos.bot.core.vHackOSBot.run(vHackOSBot.java:107)
        at net.olympiccode.vhackos.bot.core.vHackOSBot.main(vHackOSBot.java:51)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        ... 8 more
20:15:10 INFO [vHackOSBot] Shutting down...
20:15:10 INFO [vHackOSBot-Config] Saving config...
20:15:10 INFO [vHackOSBot-Config] Saved config in 2ms.
20:15:10 INFO [vHackOSBot-ConfigAdv] Saving advanced config...
20:15:10 INFO [vHackOSBot-ConfigAdv] Saved advanced config in 1ms.

2 个答案:

答案 0 :(得分:3)

使用JDK 9时,不推荐使用java.xml.bind并将其从标准类路径中删除。 它仍然存在,因此您可以尝试解决方法,并使用-add-modules 将模块添加到您的类路径中。

但是对我来说,最简单的解决方案是添加依赖项(gradle / maven):

等级:

compile 'javax.xml.bind:jaxb-api:2.3.0'

专家:

<dependency>
  <groupId>javax.xml.bind</groupId>
  <artifactId>jaxb-api</artifactId>
  <version>2.3.0</version>
</dependency>

链接到弃用摘要:https://docs.oracle.com/javase/9/docs/api/java.xml.bind-summary.html

答案 1 :(得分:0)

我发现为什么它不起作用。我需要降级到java jde和jdk 8