java - Springboot - 发生了非法反射访问操作
问题描述
我An illegal reflective access operation has occurred
在尝试构建时得到了。我已经javax.xml.bind
按照其他人的建议添加了,但我仍然得到同样的错误。
有什么建议吗?
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>demo-spring-boot</artifactId>
<groupId>demo-spring-boot</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>baseapp/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<artifactId>demo-web</artifactId>
<groupId>demo-web</groupId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<artifactId>demo-api</artifactId>
<groupId>demo-api</groupId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper-el</artifactId>
<version>8.0.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
</dependencies>
</project>
解决方案
您的 guice 与 Java 11 不兼容。
推荐阅读
- javascript - 我应该在显示之前过滤后端数据还是只选择字段并将数据保存在内存中?
- java - 如何创建一个可以将 keycloak 事件日志推送到 s3 的事件监听器?
- c# - 无法从程序集 Microsoft.AspNetCore.Routing Ver=3.1.7.0 加载类型 Microsoft.AspNetCore.Internal.EndpointRoutingApplicationBuilderExtensions
- laravel - 如何从 Laravel 中的嵌套关系中获取所有记录
- variables - 将两组变量关联为SPSS中的两个变量
- angular - Ngselect 中的项目未定义,我错过了什么?
- autofac - 如何指定 autofac 模块需要的外部依赖项
- c# - 通过 System.Reflection 获取类型:尝试强制转换时出错
- kubernetes - 在 Kubernetes 的 pod 中为单个容器使用非持久卷
- javascript - 无法使用 addEventListner 添加“活动”类