Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
异常类jdk.internal.loader.ClassLoaders$AppClassLoader不能强制转换为类java.net.URLClassLoader_Java_Spring Boot_Maven - Fatal编程技术网

异常类jdk.internal.loader.ClassLoaders$AppClassLoader不能强制转换为类java.net.URLClassLoader

异常类jdk.internal.loader.ClassLoaders$AppClassLoader不能强制转换为类java.net.URLClassLoader,java,spring-boot,maven,Java,Spring Boot,Maven,我不知道如何修复它,我第一次看到这样的错误。 我从github下载了这个,但它不起作用 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.ClassCastEx

我不知道如何修复它,我第一次看到这样的错误。 我从github下载了这个,但它不起作用

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

从pom文件中可以看出,参考了java 1.8。您可以检查java 1.8是否在您的系统路径varibale或更高版本中。如果更高版本,请使用1.8并尝试运行该程序。

从pom文件中注意到,参考了java 1.8。您可以检查java 1.8是否在您的系统路径varibale或更高版本中。如果以后使用,请使用1.8并尝试运行程序。

系统/应用程序类加载器过去是Java 8中
URLClassLoader
的实现。然而,在Java9中,这一点改变为私有(即内部)实现,不再是
URLClassLoader
的实例。您使用的Spring Boot版本似乎与此更改不兼容(即,它假定系统/应用程序类装入器是
URLClassLoader
的实例)。如果存在Spring Boot的最新版本,可以使用Spring Boot的最新版本,也可以使用Java 8来运行应用程序。系统/应用程序类加载器过去是Java 8中
URLClassLoader
的实现。然而,在Java9中,这一点改变为私有(即内部)实现,不再是
URLClassLoader
的实例。您使用的Spring Boot版本似乎与此更改不兼容(即,它假定系统/应用程序类装入器是
URLClassLoader
的实例)。如果存在Spring Boot的最新版本,请使用该版本,或者使用Java8来运行该应用程序。
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);
    }
}