Exception class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader

huangapple go评论124阅读模式
英文:

Exception class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader

问题

我不明白如何修复它,第一次看到这样的错误。
我从GitHub下载了这个项目https://github.com/nikishubin/Notebook,但它不起作用。

OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Exception in thread "main" java.lang.ClassCastException: 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')
    at org.springframework.boot.devtools.restart.DefaultRestartInitializer.getUrls(DefaultRestartInitializer.java:93)
    at org.springframework.boot.devtools.restart.DefaultRestartInitializer.getInitialUrls(DefaultRestartInitializer.java:56)
    at org.springframework.boot.devtools.restart.Restarter.<init>(Restarter.java:140)
    at org.springframework.boot.devtools.restart.Restarter.initialize(Restarter.java:546)
    at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationStartingEvent(RestartApplicationListener.java:67)
    at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationEvent(RestartApplicationListener.java:45)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
    at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:69)
    at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:292)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
    at org.surplus.radolf.Notebook.NotebookApplication.main(NotebookApplication.java:10)

Process finished with exit code 1

我的主类:

package org.surplus.radolf.Notebook;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class NotebookApplication  {
    public static void main(String[] args) {
        SpringApplication.run(NotebookApplication.class, args);
    }
}
英文:

I don't understand how to fix it, first time i see mistake like this.
i downland this from github https://github.com/nikishubin/Notebook but its does not work

OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
    Exception in thread &quot;main&quot; java.lang.ClassCastException: 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 &#39;bootstrap&#39;)
    	at org.springframework.boot.devtools.restart.DefaultRestartInitializer.getUrls(DefaultRestartInitializer.java:93)
    	at org.springframework.boot.devtools.restart.DefaultRestartInitializer.getInitialUrls(DefaultRestartInitializer.java:56)
    	at org.springframework.boot.devtools.restart.Restarter.&lt;init&gt;(Restarter.java:140)
    	at org.springframework.boot.devtools.restart.Restarter.initialize(Restarter.java:546)
    	at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationStartingEvent(RestartApplicationListener.java:67)
    	at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationEvent(RestartApplicationListener.java:45)
    	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
    	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
    	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
    	at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:69)
    	at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:292)
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
    	at org.surplus.radolf.Notebook.NotebookApplication.main(NotebookApplication.java:10)
    
    Process finished with exit code 1

my main class

package org.surplus.radolf.Notebook;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;


@SpringBootApplication
public class NotebookApplication  {
	public static void main(String[] args) {
		SpringApplication.run(NotebookApplication.class, args);
	}
}

答案1

得分: 1

从pom文件中可以看出,它指定了Java 1.8版本。请检查您的系统路径变量中是否包含Java 1.8或更新的版本。如果是更新版本,请使用1.8并尝试运行程序。

英文:

From the pom file its noted that java 1.8 is refered can you can you please check java 1.8 is in your system path varibale or later version. if later please use 1.8 and try to run the program.

答案2

得分: 0

If Java is 1.8, then check parent should match the release of the STS tools you are using (i.e.) Groupid and artifact and version

英文:

If Java is 1.8, then check parent should match the release of the STS tools you ar using (i.e.) <parent> Groupid and artifact and version </parent>

答案3

得分: -1

使用IDE内置的JDK是安装Java 8的替代方法。

在InteliJ中,您可以转到工具选项卡:

点击'编辑配置'

并选择Java 8

英文:

An alternative to installing Java 8 is to use your IDE's built in JDK.

In InteliJ, you can go to Tools tab:

Click on 'Edit Configurations'

And select java 8

huangapple
  • 本文由 发表于 2020年8月3日 02:01:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/63219405.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定